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
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
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
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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.