diogo Posted May 14, 2013 Posted May 14, 2013 If you are planning to build a template for pages that will be viewed on is own, as well as rendered from other templates try this: if ($page->url == $_SERVER["REQUEST_URI"]) include("./head.inc"); // template code if ($page->url == $_SERVER["REQUEST_URI"]) include("./foot.inc"); The head and the foot will be included only if the page is on it's own url. 6
kongondo Posted May 14, 2013 Posted May 14, 2013 Thanks for the tip. This assumes that you are using the head/foot .inc templating method, no?
diogo Posted May 14, 2013 Author Posted May 14, 2013 In this case yes, but it's just an example that can be adapted to other ways of building templates. 1
ryan Posted May 17, 2013 Posted May 17, 2013 In future versions of ProcessWire, including the current PW 2.3 dev branch, you can also do this: if(count($options['pageStack'])) { // don't include header/footer, etc. } $options['pageStack'] is an array of pages that called render(); before the current one. It basically gives a way for a page to discover the context it is being rendered in. 9
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