Jump to content

switch off the automatic append Template by API


gunter
 Share

Recommended Posts

unfortunately this following code does not work, and I don´t know why...

if($config->ajax) {
    // page was requested from ajax
    $config->appendTemplateFile = ''; // switching off the _main.php template - but does not work...
    // then do some ajax post handling here...
}

I like to use the automatic including of the _main.php, via the config.php...
but I want switch it off in my template, when a ajax call is coming...
How can I override the setting from the config.php on my page?

Is it possible, or do I have to make a separate template for this?

Link to comment
Share on other sites

I don't think you can change that setting in your template because it is already loaded. I think the best approach is to add the following to the top of the template file that is being appended.

if($config->ajax) return;

or instead you could use:

if($useAppended) return;

and then in your template files you could do:

if($config->ajax) $useAppended = true;

Lots of options really :)

  • Like 2
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...