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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

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

Post 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?
Last edited by davids355 on Sat Jan 19, 2013 6:59 pm, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
davids355
Power Poster
Power Poster
Posts: 279
Joined: Fri Apr 04, 2008 10:08 am
Location: UK

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

Post 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.
Last edited by davids355 on Sat Jan 19, 2013 6:59 pm, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post 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 ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “Developers Discussion”