Jump to content

Can you see where I'm going wrong here...


cowboysdude

Recommended Posts

I tried to rewrite this but upon enabling it I just get a blank white screen which pretty much means I've written it wrong...

 

Any suggestions/help would be greatly appreciated!

 

$i=0;
if($liststyle == 'vertical'){
$inlinestyle = 'style="display:block;clear:both;margin:10px;';
}
else{
$inlinestyle = 'style="display:block;float:left;clear:none;margin:10px;text-align:center;height=100px;width=100px;"';
}

echo '<div id="blanket" style="display:none;"></div>';
echo '<div id="popUpDiv" style="display:none;">';
echo '$vtitle';
foreach ($videos as $video){
$i++;
echo '<div $inlinestyle>';
$link = '<a href="'. (str_replace("&feature=youtube_gdata","", $video['link'])).'" onclick="popup('popUpDiv')">"'.$video['title'].'::DCC Video Library" </a>';
echo '<div>'.$link.$video['img'].'</a></div>';
}

Link to comment
https://forums.phpfreaks.com/topic/247748-can-you-see-where-im-going-wrong-here/
Share on other sites

Ok I understand the problem is in this line but not exactly sure what you mean by using the backslash

 

$link = '<a href="'. (str_replace("&feature=youtube_gdata","", $video['link'])).'" onclick="popup('popUpDiv')">"'.$video['title'].'::DCC Video Library" </a>';

You're using single quotes to enclose a string, so any single quotes within the string must be escaped with a backslash so they aren't interpreted as the closing quote for the string.

 

$string = 'You can\'t have that, it\'s Dave\'s property.'; 

 

More: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

You're using single quotes to enclose a string, so any single quotes within the string must be escaped with a backslash so they aren't interpreted as the closing quote for the string.

 

$string = 'You can\'t have that, it\'s Dave\'s property.'; 

 

More: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single

 

Oh that makes perfect sense... Many Thanks!!

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.