jon9china Posted October 14, 2015 Posted October 14, 2015 Hello, a newbie question: How do I create a template that includes some fixed html (and also a javascript file). I followed the planets tutorial which was very helpful for grasping some basic concepts, but does not seem to be totally applicable to my profile, at least. I have the Zurb Foundation profile which makes use of a _main.php (attached) and _init.php Thanks in advance for any help! _main.php
pwired Posted October 14, 2015 Posted October 14, 2015 Hi and welcome to the Processwire forum How do I create a template that includes some fixed html (and also a javascript file). Have a look at these examples https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page3 https://processwire.com/docs/tutorials/default-site-profile/page2 It doesn't matter what convention or output you use your template can include any html and javascript you want <?phpinclude("./any.inc"); include("./_any.php"); - - - - - - - - 1
jon9china Posted October 14, 2015 Author Posted October 14, 2015 Thanks for the response! Is my understanding correct, that what I can do is recreate the parts of _main.php in a new 'main.inc' file, or divide the code in main.php into 'header.inc' and 'footer.inc' and then include those in my new template file, with my own html sandwiched in there? Or, a different strategy, don't meddle with main.php and create 'mypartial.inc' and then in my template file: <?phpinclude("./mypartial.inc"); But if I do this second strategy, how do I ensure my code shows up in the region of the page that i want it (between nav and footer)?
pwired Posted October 14, 2015 Posted October 14, 2015 Thanks for the response! Is my understanding correct, that what I can do is recreate the parts of _main.php in a new 'main.inc' file, or divide the code in main.php into 'header.inc' and 'footer.inc' and then include those in my new template file, with my own html sandwiched in there? main.inc and _main.php are only two different conventions but do the same thing. https://processwire.com/docs/tutorials/default-site-profile/page2 https://processwire.com/docs/tutorials/default-site-profile/page3 But if I do this second strategy, how do I ensure my code shows up in the region of the page that i want it (between nav and footer)? To know where you need to put your include file simply depends on where you have setup the other regions in your html page
pwired Posted October 14, 2015 Posted October 14, 2015 I found an old post here in the forum when I first started and struggled with this topic my self, this thread might clarify it more: https://processwire.com/talk/topic/3388-question-about-headinc-and-footerinc/ 1
jon9china Posted October 14, 2015 Author Posted October 14, 2015 ok, Thanks for the help once again. That last link led me to something that was helpful. I think I'm getting a little foothold now. This is the resource that was of most direct help for any other newbies struggling with a 'main.php' or 'main.inc' setup (as opposed to the 'beginner' profile install that breaks things up into head and foot.inc) https://processwire.com/docs/tutorials/how-to-structure-your-template-files/page4 Really great community here!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now