Jump to content

Creating Module for Redirect when Template has no File


Orkun
 Share

Recommended Posts

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

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...