zang8027 Posted January 8, 2010 Share Posted January 8, 2010 I want to put this into an include but.. as you can see, it uses both ' and " so i dont know how to do this. <div id="footer"> <div class="sub-nav"> <a href="index.php" onmouseover="roll('sub_but', 'images/sub-home-btn-over.png')" onmouseout="roll('sub_but', 'images/sub-home-btn.png')"><img src="images/sub-home-btn.png" alt="home" name="sub_but"/></a> So i cant really do: <?php echo' <div id="footer"> <div class="sub-nav"> <a href="index.php" onmouseover="roll('sub_but', 'images/sub-home-btn-over.png')" onmouseout="roll('sub_but', 'images/sub-home-btn.png')"><img src="images/sub-home-btn.png" alt="home" name="sub_but"/></a> '; ?> Any suggestions? Link to comment https://forums.phpfreaks.com/topic/187734-include-help/ Share on other sites More sharing options...
cags Posted January 8, 2010 Share Posted January 8, 2010 If you are saying that is going to be in an include file you can just put the HTML in the file it doesn't need to be echo'd. Alternatively you can use the heredoc syntax. $example = <<<HTML <div id="footer"> <div class="sub-nav"> <a href="index.php" onmouseover="roll('sub_but', 'images/sub-home-btn-over.png')" onmouseout="roll('sub_but', 'images/sub-home-btn.png')"><img src="images/sub-home-btn.png" alt="home" name="sub_but"/></a> HTML; echo $example; Link to comment https://forums.phpfreaks.com/topic/187734-include-help/#findComment-991159 Share on other sites More sharing options...
gerardcorr Posted January 8, 2010 Share Posted January 8, 2010 if its wrapped with ' then all the inner ' you need to change to \' ie echo 'don\'t screw up'; Link to comment https://forums.phpfreaks.com/topic/187734-include-help/#findComment-991166 Share on other sites More sharing options...
zang8027 Posted January 8, 2010 Author Share Posted January 8, 2010 i never heard of this <<<HTML HTML; thing.. it put it in but now the css is all messed up when do that.. its like..the page does not recognize that html being part of the page its included into. Its there in the view source when i view it though. Link to comment https://forums.phpfreaks.com/topic/187734-include-help/#findComment-991173 Share on other sites More sharing options...
cags Posted January 8, 2010 Share Posted January 8, 2010 As I said if all you are doing is include'ing the HTML and that's all that's in the file just write it in the file as is (ie as it is in your first code block of your OP). Link to comment https://forums.phpfreaks.com/topic/187734-include-help/#findComment-991177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.