LimeWub Posted January 17, 2017 Share Posted January 17, 2017 Hey, I am using a block-like structure for a website I'm building, in which a page can be created using many building block "pages". For example - Page - slideshow block ("Page") - content block ("Page") On render, Page gets all it's children blocks and renders them. Everything with this approach works great, however, I have one issue... Issue: Block templates have a template file (to render with). This makes them accessible by url. For example: website.com/page/slideshow-block is a (very ugly) page on the site atm. Question: Is there any way to block certain templates from being accessed by their url? Seems like something that should be feasible but I just can't find the setting/way to do it... Thanks Link to comment Share on other sites More sharing options...
louisstephens Posted January 17, 2017 Share Posted January 17, 2017 Hey @LimeWub, I found a soultion to your question. If you go to the template being used by slideshow and navigate to the "Access" tab, you can achieve what you are after. In my case (for the test), I simply unchecked view pages for guest, and selected "Redirect to another URL" which allowed me to keep the page from being accessed by someone not already logged in with the proper credentials. 3 Link to comment Share on other sites More sharing options...
kongondo Posted January 17, 2017 Share Posted January 17, 2017 There's a couple of approaches Unpublish you block pages: You will still be access them via the API with include=all in your -Page template. You would have to handle 404s in this case Redirect: Redirect access to block pages to -Page. SEO issues? Etc...(I've gone totally blank but there should be another strategy, I think ) 2 Link to comment Share on other sites More sharing options...
LimeWub Posted January 17, 2017 Author Share Posted January 17, 2017 Thanks for the responses guys! I got it! (not sure how I had missed it earlier...) Anyway, I've attached the settings I'm using for the block. Very similar to what @louisstephens suggested Thanks so much for pointing me to the right direction! 1 Link to comment Share on other sites More sharing options...
Robin S Posted January 17, 2017 Share Posted January 17, 2017 A couple more options... At the top of the file for the template of pages you are including inside another page: if(empty($options['pageStack'])) throw new Wire404Exception(); if($page->url == $_SERVER['REQUEST_URI']) throw new Wire404Exception(); A related thread: 4 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