bwakad Posted April 14, 2014 Share Posted April 14, 2014 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? Link to comment Share on other sites More sharing options...
Martijn Geerts Posted April 15, 2014 Share Posted April 15, 2014 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now