Jump to content

Recommended Posts

Posted

PW is awsome!

my URL is " host / provincie / drenthe "

my URL is " host / branche / overheid "

All my parent pages : provincie, branche, etc are using 1 template file "select.php"

All my child pages are using a template file called after the parent, e.g. "(parent).php"

Those (parent).php files only have 3 lines of code for including:

header.inc

browse.inc // has the code shown below

footer.inc

My fields are "provincie" and "branche" as you would have noticed a page select.

"browse.inc" file is the holder for most of my code (layout and structure) and before my code display anything I now have this:

$field = $page->fields->get("name"); 
// this returns the name = 'provincie'
$selects = $pages->find("template=child-template, {$field}={$page->id}"); 
// this returns the value = 'drenthe'

I could have used:

$selects = $pages->find("template=child-template, provincie={$page->id}"); 
// this returns the value = 'drenthe'

But then I could not use browse.inc anymore and had to do this for each field on each template.

I am no to good with PW and wonder if this could be improved?

Posted

Didn't read your message very well, nevertheless I hope that you get what I want to say. I can see you love using relative names (child-template, parent-template etc.).

Using names this way makes it really confusing. What if the child-template, has children and if those children have children to? You'll end up with a template named child-template who is actually grandpa. Consider relative template names in a static way bad practice.

My father is child of my grandpa and is grandpa of my child.

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