Hi
I have a plugin that sets a session var (see http://ellislab.com/forums/viewthread/177971/ for details) and I then depend on that session var to compile my templates. However I am finding that the variable is not set the first time a page is compiled, presumably because my plugin is parsed too late.
What’s the best way to run code before anything takes place? I am hoping I don’t need to add code to the /index.php file or anything like that - I’d much rather be extending in the correct way.
Here’s an example of my page template:
{embed="global-embeds/header"
body-id="index"
robots="all"
has-aside="n"
}
<h1>Home Page</h1>
{embed="test_inc/.{exp:deetective:get_template_type}_body"}
{embed="global-embeds/footer"}Inside my global-embeds/header template, I am calling a plugin at the very top to set my session var:
{exp:deetective:set_template_type}
<!doctype html>
<html lang=en>
<head>
etc…Then back in the parent template, I am retrieving the value of that session variable to call the relevant embed file (so evals to something like ‘test_inc/.default_body’.
Thanks