Jump to content

Why the header and footer comes after body ? (Planets Tutorial)


cssabc123
 Share

Recommended Posts

Why the header and footer comes after body when rendered? (Planets Tutorial). The planets who are using the planet.php template are children of a page Planets which is based on basic-page.php template. The About page children pages works fine though.

site/templates/planet.php

<html>
  <head>
    <title><?php echo $page->title; ?></title>
  </head>
  <body>
    <h1><?php echo $page->title; ?></h1>
    <h2>
        Type: <?php echo $page->planet_type; ?>,
        Age: <?php echo $page->planet_age; ?> years
    </h2>
    <p><?php echo $page->planet_summary; ?></p>
  </body>
</html>

Link to comment
Share on other sites

Are you using "includes"?

Have you, for example, put this part in the header?:

<html>
  <head>
    <title><?php echo $page->title; ?></title>
  </head>
  <body>

And this part in the footer?:

</body>
</html>

Please give more details about your approach, your structure(, the profile you use as a basis), etc.

  • Like 1
Link to comment
Share on other sites

Please give more details about your approach, your structure(, the profile you use as a basis), etc.

let me add some more information you could provide as there was... PW version, screenshots of your template settings.

but christophe has wrote the right and important hint already...;)

What profile you used as start for the tutorial?

If you get header and footer rendered you should check the settings for prepending and apending templates or includes....so check if you have a _init.php or something else in your profile.

For a beginner it could be very strange to get started in face of the many many many options you can take. If you are getting more familiar with the system and find your own way to use templates and site profiles you will love the given freedom.

Like in many other topics wrote a:

Site profile is only the place to play for your own frontend.

Template "files" in the profile are only showing content or data in the way you build it (html,css,json,file,everything you want)

Templates itself - with or even without a file (for special contenttype or backend only content...) are a kind of building your content and data model for different needs, you have the power to give them the fields you need, you could connect templates(contenttypes) with Pagefields (example template autor is connected with a pagefield to every article this autor wrotes), you could setup the given fields with various field dependencies, using hooks and much more to get what is needed or should be the final result.

Pages are every piece of data, object and could represent every type of content you "preset" with given fields and settings on the used template...

Best place to read for beginners is a great writeup for beginners on every important topic....the footer/header includes, too

it's a big topic from pwired but it helped me very very much at the starting questions....so take a good read on this.

What helped me very fast to get started on the template/field/page thing are some couple of videos, too.

Best regards mr-fan

  • Like 3
Link to comment
Share on other sites

I just found softacolous from my webhost provides different structure from what I can download from processwire.com.

Don't use any script or structure from softacolous. All you need is the webspace from your hoster. Make sure you delete any welcome html/ php file and scripts from your hoster. If you see any default .htaccess file open it first to see any hosting restrictions/configurations from their side. Then delete the .htaccess file also. So when you have empty webspace then

upload the processwire files and install processwire. If this is not what it is about in your case then post some more information

to help you out.

  • Like 1
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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