stubarny1 Posted June 19, 2011 Share Posted June 19, 2011 Hello, I'd like to reuse a piece of html code on several pages. If this was a php module I would use the require() function but I would like to be able to use raw html (to avoid having to put all the html code into php echo statements). Please could you tell me if this is possible? Many Thanks, Stu Quote Link to comment https://forums.phpfreaks.com/topic/239790-how-do-you-call-an-html-module/ Share on other sites More sharing options...
redixx Posted June 19, 2011 Share Posted June 19, 2011 It would be best to do it dynamically so that you don't have a ton of pages with the same code, as that makes changing things a pain in the ass. Quote Link to comment https://forums.phpfreaks.com/topic/239790-how-do-you-call-an-html-module/#findComment-1231744 Share on other sites More sharing options...
AbraCadaver Posted June 19, 2011 Share Posted June 19, 2011 Use include() or require(). They both expect raw HTML, that's why you must put PHP tags in it if it is PHP code and not HTML. Quote Link to comment https://forums.phpfreaks.com/topic/239790-how-do-you-call-an-html-module/#findComment-1231752 Share on other sites More sharing options...
stubarny1 Posted June 19, 2011 Author Share Posted June 19, 2011 Thanks AbraCadaver, another lesson learnt Quote Link to comment https://forums.phpfreaks.com/topic/239790-how-do-you-call-an-html-module/#findComment-1231797 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.