Jump to content

How to create Page and children pages


magnus_vb
 Share

Recommended Posts

Hello

I have done some sites using EE - but are now looking at PW as a replacement. But my brain is still "wired" for the EE way with channels and stuff.

Therefor I have some basic questions about PW's features and way to do things. I did the Planet tutorial - short and sweet - that helped to do the very basic things. But I have some follow up questions.

1. How to create a parent page called "Planets" with each planet page (Earth, Jupiter...) as a subpage? These subpages should not be visible in the menu - just linked to from the Planets page? Much like the Skyscraper demo site which have "Cities" as a page (with just one field Title) and each city as child pages.

The children pages should have a lot more fields, so how do I select another template for them?

2. A lot more questions… but I will try for my self a little more first :)

Best Regards, Magnus

Link to comment
Share on other sites

The page tree you see in your PW admin is your page structur. As you already figured out - unlike other systems - you have to create everything like news or your planets with your own logic on how to sort those pages. So if you only want the first level of the pagetree as your navigation, you would only output the children of / and don't go deeper into the structur. This is done by your templates.

Make a page called "Planets". Now click on it and then this time click on the "new" link next to "Planets". This will create a child page of "Planets" with another template like "planet".

For each page you can select the template while first creating the page. It is the last dropdown after you clicked on "New". 

If you want to display somewhere on your site(in your template), you have to loop through the children of your page.

<?php foreach($page->children->find('template=planet') as $child){
echo $child->title; // Your menu or whatever
};?>

The Cheatsheet helped me alot

Link to comment
Share on other sites

Thanks, Philipp

One follow up question about children pages: Which template (or page structure) should I use for the child pages?

Here are a static version of the site: cigar2.se. (Select Aktuellt -> Matchreferat to see the second level menu in right column)

- None of the top menu items will be viewable as a page, so I followed the Skyscraper demo and created one empty template for each top menu item.

- Created a page under "Home" with just a title field. For example a page called "Aktuellt". Simple, empty template

- Created a page under "Aktuellt" with just a title field. For example a page called "Matchreferat". Simple, empty template

- Then under "Matchreferat" every individual article will have it's own page using a custom template. This page will be in two part: top part with the latest article and below that a list of headlines for older articles - clickable to read them.

In admin it looks like this:

Home

--> Aktuellt

----> Matchreferat

------> (each article)

Is this the right way to do it?

Regards, Magnus

Link to comment
Share on other sites

There are a lot of ways you could do this. But this how I would do this:

I would create a template called "toppages" or "navpages" or so only including the  "title"-field. "Aktuellt" and "Matchreferat" would use this template (if you don't need more content for this pages).

And for the articles I would create a template called "article". Including "title"-, "body"-, ...-field.

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