Jump to content

Recommended Posts

Posted

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

Posted

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

<?php
include("./any.inc");

include("./_any.php");

- - - -

 - - - -

  • Like 1
Posted

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:

<?php
include("./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)?

Posted

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

Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...