Jump to content

[SOLVED] - Planet tutorial Step 3


Martinus
 Share

Recommended Posts

In step 3 at the end it says

  • Now you have created a new page using the template that you added. You are now in the page edit screen and you should see your title field populated with "Earth". Click the View link that appears on this page edit screen. You should see the output of the HTML from step 1. Click the back button in your browser to return to the edit screen.

I have this: 

Home>Earth

default content

edit this page

did I do something wrong?

Link to comment
Share on other sites

In step 1 it should be this:

<div id="content">
<html>
  <head>
    <title>Earth</title>
  </head>
  <body>
    <h1>Earth</h1>
    <h2>Type: Happy planet, Age: Millions of years</h2>
    <p>Earth (or the Earth) is the third planet from the Sun,
    and the densest and fifth-largest of the eight planets
    in the Solar System. It is also the largest of the Solar
    System's four terrestrial planets. It is sometimes
    referred to as the World, the Blue Planet, or by its
    Latin name, Terra.</p>
  </body>
</html> 
</div>

when placed in between the <div id="content"> ... </div> it works, but I do not know why?

Link to comment
Share on other sites

1 hour ago, Martinus said:

I have this: 

Home>Earth

default content

edit this page

Does your Earth page use the template "planet" that you set up in Step 2? I imagine this is the problem. Check the page’s settings tab, it’s probably "basic-page".

If that’s not the issue, did you use all the same names from the tutorial? ProcessWire auto-detects the template file from Step 1 and uses it for the template in Step 2 if they have the same names (without the .php extension). So your template should be named "planet" and the file in /site/templates/ should be named "planet.php". Although if ProcessWire couldn’t auto-detect the template file, you shouldn’t be able to view the page at all.

Link to comment
Share on other sites

Yes I did.

My host directory is: www/production/site/templates

and has files like this: _init.php _main.php admin.php basic-page.php home.php and planet.php

In admin going to setup > templates it has the basic-page, home and planet templates.

the page earth uses planet template.

 

Link to comment
Share on other sites

Yes I found it. I feel so stupid. Upon installation I thought it was not mandatory to use. Now my question: is it better to use that, or do it without? I could only think about benefits such as SEO or scroll to section actions.

Link to comment
Share on other sites

2 minutes ago, Martinus said:

Yes I found it. I feel so stupid. Upon installation I thought it was not mandatory to use. Now my question: is it better to use that, or do it without? I could only think about benefits such as SEO or scroll to section actions.

I find it useful as unlike Direct Output you can define a variable in your page template and then refer to that variable in your header. I only use a single markup definition, and put all of my template code - excluding header and footer - within it.

Link to comment
Share on other sites

31 minutes ago, Martinus said:

Thanks all, for thinking with me. This topic can be closed as solved.

You can just edit the first post and prefix the topic with [solved] 🙂 

  • Like 1
Link to comment
Share on other sites

  • Martinus changed the title to [SOLVED] - Planet tutorial Step 3

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...