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>'; } Quote Link to comment 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. Quote Link to comment 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>'; Quote Link to comment 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 Quote Link to comment 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!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.