Let's say I want to create a tag/plugin and I need to access the current page's title. Should I call the smarty_cms_function_title() function in function.title.php or should I get it using something like &$gCms->variables['pageinfo']->content_title? What's the correct way of doing things?
I noticed that the using the smarty_cms_function_title() function results in an error while previewing content at Content » Pages » Edit Page...
Should I use smarty_cms_function_title?
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: Should I use smarty_cms_function_title?
I would access it like the title plugin/tag does it:hansom wrote: Let's say I want to create a tag/plugin and I need to access the current page's title. Should I call the smarty_cms_function_title() function in function.title.php or should I get it using something like &$gCms->variables['pageinfo']->content_title? What's the correct way of doing things?
I noticed that the using the smarty_cms_function_title() function results in an error while previewing content at Content » Pages » Edit Page...
Code: Select all
global $gCms;
$pageinfo = &$gCms->variables['pageinfo'];
echo $pageinfo->content_title;
http://viewsvn.cmsmadesimple.org/viewsv ... 4&view=rev
Hope this helps,
Elijah
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 

Re: Should I use smarty_cms_function_title?
Thanks. In general, are you saying that one should not make direct function calls like smarty_cms_function_title() or to other plugins when coding modules and plugins, but rather do it "like the title plugin/tag does it"?Elijah Lofgren wrote: I would access it like the title plugin/tag does it:
- Elijah Lofgren
- Power Poster
- Posts: 811
- Joined: Mon Apr 24, 2006 1:01 am
- Location: Deatsville, AL
Re: Should I use smarty_cms_function_title?
I don't really know what is considered best. I think calguy100 or Ted would be better able to tell you.hansom wrote:Thanks. In general, are you saying that one should not make direct function calls like smarty_cms_function_title() or to other plugins when coding modules and plugins, but rather do it "like the title plugin/tag does it"?Elijah Lofgren wrote: I would access it like the title plugin/tag does it:

I know that I've never directly called a "smarty_cms_function_()" before so I was more inclined to not do it.
If you'd like to try asking Ted or calguy1000 (in case they don't read this topic), feel free to come into the CMSMS IRC channel by clicking the "Chat" button at the top of the forums or go to the #cms channel on irc.freenode.net

Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. 
