[solved] Get value of {title} tag and use it in PHP script
Posted: Wed Nov 16, 2011 3:10 pm
Hello All,
First, I will apologize for my lack of knowledge on the subject. I was basically given a project to work on and told to get it to work. 2 days ago I had absolutely zero experience with PHP or CMSMS. I am doing my best but need some help here. I think it may just be something simple.
In our template we want to have the title of the page be displayed at the top of our content section. We were using the {title} tag for this. However, we needed the title to be in 2 colors. The first half of the title in one color, the second half in another. With the help of some code writers, I now have the following code which I have turned in to a User Defined Tag: {split_title}
As you can see, I have the variable $myTitle set to be a static string right now. When I test the page, this works. I need to be able to set the variable $myTitle to be equal to the value the {title} tag produces. I tried using the following but it did not work
I think maybe because "title" is a UDT and not a template variable? Any help here is very much appreciated.
First, I will apologize for my lack of knowledge on the subject. I was basically given a project to work on and told to get it to work. 2 days ago I had absolutely zero experience with PHP or CMSMS. I am doing my best but need some help here. I think it may just be something simple.
In our template we want to have the title of the page be displayed at the top of our content section. We were using the {title} tag for this. However, we needed the title to be in 2 colors. The first half of the title in one color, the second half in another. With the help of some code writers, I now have the following code which I have turned in to a User Defined Tag: {split_title}
Code: Select all
function multiColorHeading($input,$class1 = 'res-heading-black',$class2 = 'res-heading-golden') {
$temp = explode(' ',$input);
$half = count($temp) / 2;
$first = array_slice($temp,0,$half);
$second = array_slice($temp,$half);
return '<span class="'.$class1.'">'.implode(' ',$first).'</span> <span class="'.$class2.'">'.implode(' ',$second).'</span>';
}
$myTitle = 'Title Goes Here'; {
echo multiColorHeading($myTitle);
}
Code: Select all
$myTitle = $smarty->get_template_vars('title');