Jump to content

Recommended Posts

Posted

Hello everbody

I want to make a autoload module that checks if the current page template exist, when not it should make a redirect to its parent page.

I thought of something like this:

public function init() {
 
  if(!$this->page->template->filenameExists()) continue;

  $this->session->redirect($this->page->parent->url);
        
    
}

My Problem is that when i add a Page via Fredi from the Frontend it redirects to a page that doesnt exist in the frontend. This is because I create Classifications Pages that have a template but not a template file because its not necessary in my case.

I know, that i could just write in the templates something like this:

$session->redirect($page->parent->url);

But they are 8 templates that i have to create and write this and in my view that is unnecessary when i could achieve this only via a module.

Thank you for your attention

- Nukro

Posted

Easiest way would probably be to have a template file with the redirection and set those templates to use it on the "files" tab of the template settings.

  • Like 2

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
×
×
  • Create New...