I am working on a plugin in EE2.0
It looks at the url and breaks it out and makes assumptions based on the data on the url segment. I then pass back a word:
try
{
switch($this->_type)
{
case 'category':
$this->return_data = trim($this->_type);
break;
case 'city':
$this->return_data = 'city';
break;
case 'state':
$this->return_data = 'state';
break;
default:
throw new Exception('Invalid search type ' . $this->_type);
break;
}
}
...In my template it starts with:
{preload_replace:controller="{exp:urlcheck}"}If I output {controller} it displays the value I expect
I then want to test that value and based on it embed a specific template:
{if controller == "category"}
{embed="/category"}
{if:elseif controller == "city"}
{embed="/city"}
...
{/if}It never seems to match. If I highlight the output of controller and paste it I will notice white space padded on the end. I tried to trim as you can see above but no luck.
Should I be able to test a preload_replace variable like I am, if not is there another solution?
Is this possibly a bug?
Thanks!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.