In a plugin is it possible to output the equivalent of {embed="my_template"} if a certain condition is met?
My site index file is as follows at the moment, with php enabled and set to input:
<?php
// Define segment one variable
$seg1 = $this->EE->uri->segment(1);
// If this is the homepage, embed the homepage template
if($seg1 == "") { ?>{embed="embeds/homepage"}<?php
} else {
// IF NOT HOMEPAGE, DO THIS...
if(substr($seg1, 0, 11) == "property-in") // if first 11 characters = 'property-in'
{
?>{embed="embeds/property-in-town" url_title="<?php $seg1;?>"}<?php
} else {
?>{embed="embeds/town-property" url_title="<?php $seg1;?>"}<?php
}
}
So what I'd like to do is move this to a plugin and avoid having php turned on.
Cheers
Jim