cowboysdude Posted September 24, 2011 Share Posted September 24, 2011 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 More sharing options...
Pikachu2000 Posted September 24, 2011 Share Posted September 24, 2011 You need to escape (with a backslash) the single quotes within the single quoted string where you assign the value to $link. Link to comment https://forums.phpfreaks.com/topic/247748-can-you-see-where-im-going-wrong-here/#findComment-1272217 Share on other sites More sharing options...
cowboysdude Posted September 24, 2011 Author Share Posted September 24, 2011 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>'; Link to comment https://forums.phpfreaks.com/topic/247748-can-you-see-where-im-going-wrong-here/#findComment-1272360 Share on other sites More sharing options...
Pikachu2000 Posted September 24, 2011 Share Posted September 24, 2011 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 Link to comment https://forums.phpfreaks.com/topic/247748-can-you-see-where-im-going-wrong-here/#findComment-1272371 Share on other sites More sharing options...
cowboysdude Posted September 24, 2011 Author Share Posted September 24, 2011 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!! Link to comment https://forums.phpfreaks.com/topic/247748-can-you-see-where-im-going-wrong-here/#findComment-1272395 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.