i had to use backslashes...^^ it works now thanks for your time guys..appreciate it :)
On 30 Okt., 22:10, "flo.kl...@googlemail.com" <flo.kl...@googlemail.com> wrote: > I always use “ to encapsulate the string I want to echo. Then you can use ' > within and it will be echoed as well. > A short example: > echo “<div id='myId'>“.$array['fieldName'].“</div>“; > > -flosky > > Tomfox Wiranata <tomfox.wiran...@gmail.com> schrieb: > > lets say i wanna go with echo, how do i need to quote or escape the > current code, that it works? > cause i have no idea how to implement the value thing.. > > thanks..appreciate it > > On 30 Okt., 05:52, Ryan Schmidt <google-2...@ryandesign.com> wrote: > > > > > > > > > > > On Oct 29, 2011, at 10:56, Tomfox Wiranata wrote: > > > > echo '<div id="showGoogleMap" onclick="showGoogleMap('.$all['id'].','. > > > $all['BooksUser']['latitude'].', > > > '.$all['BooksUser']['longitude'].','.$all['title'].')" > > > style="float:right;cursor:pointer;">'.$html->image("icons/map.png", > > > array("alt" => "Google Map anzeigen")).'</div>'; > > > [snip] > > > > now when I hit > > > the icon to open the map, firebug says this: > > >_____________________________________________ > > > > missing ) after argument list > > > showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph) > > > As you see from the error message (or by viewing source on the page), your > > PHP code generated the following HTML code: > > > <div id="showGoogleMap onclick="showGoogleMap(207,47.378824,8.548737,Tag > > Heuer Carrera Chronograph)" style="float:right;cursor:pointer;">...</div> > > > What got generated inside the onclick attribute is not valid JavaScript > > code, because the title string is not quoted or escaped properly. You > > probably want to use JsHelper::value($all['title']) instead of just echoing > > $all['title'] directly. > > -- > Our newest site for the community: CakePHP Video > Tutorialshttp://tv.cakephp.org > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others > with their CakePHP related questions. > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php