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. Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/ 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]"; Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509381 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; ?> Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509382 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 Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509389 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... Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509390 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 Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509393 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; ?> Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509394 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> Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509400 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; } Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509407 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. Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509409 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; ?> Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509411 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 Link to comment https://forums.phpfreaks.com/topic/99573-help-with-slashes/#findComment-509416 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.