mikefrederick Posted April 4, 2008 Share Posted April 4, 2008 I cannot figure out how to do the slashes on $xx for this: onmouseover="return thistitle('<div align=\'center\' class=\'boxtitle\'><?=$xx;?></div>');" $xx="<a class='readmore' href='javascript:void(0);' onclick='window.open(\'events_view.php\',\'Events View\',\'width=300, height=300, scrollbars=no\');'>(read more)</a>"; Basically it is third level apostrophes I need to figure out...I tried the heredoc method, couldn't figure it out...any help is appreciated. Maybe addslashes? I dont know. Quote Link to comment Share on other sites More sharing options...
conker87 Posted April 4, 2008 Share Posted April 4, 2008 Try $xx="<a class='readmore' href='javascript:void(0);' onclick=\"window.open('events_view.php','Events View','width=300, height=300, scrollbars=no');\">(read more)[/url]"; Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 4, 2008 Share Posted April 4, 2008 you can just do something like <?php $code =<<<HTML <a href = "http://www.google.com">Google.com</a> ' '' '' '' ' '''''''''''''''''''''''''''''''''''''' ' ' ' " ' " " " ' '' " " " ' <a class='readmore' href='javascript:void(0);' onclick="window.open('events_view.php','Events View','width=300, height=300, scrollbars=no')";>(read more) HTML; ?> Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 4, 2008 Author Share Posted April 4, 2008 if i did what the conker said it would end the function with the first '. phpsensei i don't really understand the heredoc method, could you help me out a bit more Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 4, 2008 Author Share Posted April 4, 2008 i tried addslashes and the code looks correct in a browser, it has \\\ before the third level apostrophe's, but a new window doesn't open so i dont know... Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 4, 2008 Share Posted April 4, 2008 The addslashes() function should not be used when sending information to the browser to be interpreted. Can you tell us the context in which you're using these lines? onmouseover="return thistitle('<div align=\'center\' class=\'boxtitle\'><?=$xx;?></div>');" <?php $xx="<a class='readmore' href='javascript:void(0);' onclick='window.open(\'events_view.php\',\'Events View\',\'width=300, height=300, scrollbars=no\');'>(read more)</a>"; ?> Ken Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 4, 2008 Share Posted April 4, 2008 if i did what the conker said it would end the function with the first '. phpsensei i don't really understand the heredoc method, could you help me out a bit more Facilitates the quoting task Example <?php $sql_insert_photo =<<<EndSQL INSERT INTO collection (title, major_category, subcategory, location, event_date, collection_dir) VALUES ('{$VALS['title']}', '{$VALS['major_cat']}', '{$VALS['subcat']}', '{$VALS['location']}', '{$VALS['date']}', '{$VALS['unique_path']}'); EndSQL; ?> Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 4, 2008 Author Share Posted April 4, 2008 sure.... <?php if($desclen>100) { $descr.=substr(htmlentities($fetchdates['description']),0,100)."..."; $xx="<a class='readmore' href='javascript:void(0);' onclick='window.open(\'events_view.php\',\'Events View\',\'width=300, height=300, scrollbars=no\');'>(read more)</a>"; $descr.= addslashes($xx); } else { $descr=htmlentities($fetchdates['description']); } ?> i have a link that onmouseover uses the overlib function: <a href="calendar.php?id=<?=$fetchdates['id'];?>" onmouseover="return overlib('<div align=\'center\' class=\'boxtitle\'><?=$fetchdates['title'];?></div><div class=\'times\'><?=$times;?></div><div class=\'boxmain\'><?=$descr;?></div><div class=\'boxtype\'><?=$type;?></div>', STICKY, 'refmark<?=$date;?>', ANCHORALIGN, 'UR', 'UR', CAPTION, '<?=$topofbox;?>');" onfocus="this.blur()"><?=$fetchdates['title'];?></a> Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 4, 2008 Author Share Posted April 4, 2008 i tried without success: <?php $descr.=substr(htmlentities($fetchdates['description']),0,100)."..."; $descr.=<<<TEST <a class='readmore' href='javascript:void(0);' onclick='window.open(\'events_view.php\',\'Events View\',\'width=300, height=300, scrollbars=no\');'>(read more)</a>; TEST; } Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 4, 2008 Share Posted April 4, 2008 i tried without success: <?php $descr.=substr(htmlentities($fetchdates['description']),0,100)."..."; $descr.=<<<TEST <a class='readmore' href='javascript:void(0);' onclick='window.open(\'events_view.php\',\'Events View\',\'width=300, height=300, scrollbars=no\');'>(read more)</a>; TEST; } you dont need the slashes anymore, thats the whole point of it. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted April 4, 2008 Share Posted April 4, 2008 <?php $descr=<<<TEST <a class='readmore' href='javascript:void(0);' onclick="window.open('events_view.php','Events View','width=300, height=300, scrollbars=no');">(read more)</a>; TEST; echo $descr; ?> The javascript also has an invalid arguement try <?php $descr=<<<TEST <a class="readmore" href="javascript:void(0);" onclick="window.open('events_view.php','Events View',width=300,height=300)">(read more)</a>; TEST; echo $descr; ?> Quote Link to comment Share on other sites More sharing options...
mikefrederick Posted April 4, 2008 Author Share Posted April 4, 2008 couldnt get it, i just made the function an external javascript and thereby removed a bunch of quotes Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.