Page 1 of 1

Help getting the page title from a UDT in 1.11 [SOLVED]

Posted: Tue Jan 15, 2013 7:28 am
by davids355
Hi, I have had a UDT in my site that gets page title (so I can display content based on the current page).

Code: Select all

global $gCms;
  $smarty = &$gCms->GetSmarty();
  $smarty_data = "{title}";
  $smarty->_compile_source('temporary template', $smarty_data, $_compiled );
  @ob_start();
  $smarty->_eval('?>' . $_compiled);
  $_contents = @ob_get_contents();
  @ob_end_clean();
Since I upgraded to 1.11.4, this does not work, and I understand that &$gCms has been deprecated?
Unfortunately I am not an experienced coder at all, and I cannot seem to find information anywhere on how to get the page title into a variable post 1.11.

Can someone help?

Re: Help getting the page title from a UDT in 1.11

Posted: Tue Jan 15, 2013 10:12 am
by Rolf

Re: Help getting the page title from a UDT in 1.11 [SOLVED]

Posted: Tue Jan 15, 2013 10:34 am
by davids355
thats perfect thanks! I honestly spent about 25 minutes Googleing this, and I actually visited that page, but didnt see the code:(
I must be getting old.

Re: Help getting the page title from a UDT in 1.11 [SOLVED]

Posted: Tue Jan 15, 2013 10:36 am
by Rolf
davids355 wrote:thats perfect thanks! I honestly spent about 25 minutes Googleing this, and I actually visited that page, but didnt see the code:(
I must be getting old.
Hahaha, don't worry :-) I just added that part to the docs website because of your question ;)