Quote:
Originally Posted by Black Snow
I eventually got this to work. Not sure why it won't work on my custom pages.
|
Probably you did not cache your custom template. If it's not in the cache, there's nothing to replace. It will be queried directly from the database as is.
Quote:
Anyway, is there any way to use the above code and have 10 different templates changed using an array or something like this?
PHP Code:
if ($this->template == 'OLD TEMPLATE NAME 1')
{
$this->template = 'NEW TEMPLATE NAME 1';
}
if ($this->template == 'OLD TEMPLATE NAME 2')
{
$this->template = 'NEW TEMPLATE NAME 2';
}
if ($this->template == 'OLD TEMPLATE NAME 3')
{
$this->template = 'NEW TEMPLATE NAME 3';
}
if ($this->template == 'OLD TEMPLATE NAME 4')
{
$this->template = 'NEW TEMPLATE NAME 4';
}
So instead of a new plugin for each template I change something in, I can do it all in one plugin.
|
You don't need more than one plugin. You can put that code as is into one plugin. Of course you could also do something like
PHP Code:
$replace = array(
'old1' => 'new1',
'old2' => 'new2',
'old3' => 'new3'
);
foreach ($replace as $key => $value)
{
if ($this->template == $key)
{
$this->template = $value;
}
}