diogo Posted May 14, 2013 Share 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 Link to comment Share on other sites More sharing options...
kongondo Posted May 14, 2013 Share Posted May 14, 2013 Thanks for the tip. This assumes that you are using the head/foot .inc templating method, no? Link to comment Share on other sites More sharing options...
diogo Posted May 14, 2013 Author Share 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 Link to comment Share on other sites More sharing options...
ryan Posted May 17, 2013 Share 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 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