Jump to content

help with slashes!


mikefrederick

Recommended Posts

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

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

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

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

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

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

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

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.