Development: Smarty function depending on cms_selflink

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
philonor
New Member
New Member
Posts: 7
Joined: Mon Oct 22, 2012 7:37 am

Development: Smarty function depending on cms_selflink

Post by philonor »

Hi,

currently I'm trying to develop a module replacing all external links by an internal link to a "goodbye" page.

To generate this goodbye page link, I'm calling cms_selflink, because I want the module to be sustainable.
That requires the cms_selflink smarty function to be loaded before my cms_extlink smarty function.

How can I have a bearing on the loading order of smarty functions? Or ensure that cms_selflink was loaded before?

At the moment, I'm just embedding a {cms_selflink} tag in template header, but it seems to me that this does not work in the new cmsms version (1.11).

In my cms_extlink smarty function, I check via function_exists whether cms_selflink is available. If not, I just do nothing in order to avoid a complete site crash.

Any best practice for smarty functions depending on others?
philonor
New Member
New Member
Posts: 7
Joined: Mon Oct 22, 2012 7:37 am

Re: Development: Smarty function depending on cms_selflink

Post by philonor »

Noone any idea?
philonor
New Member
New Member
Posts: 7
Joined: Mon Oct 22, 2012 7:37 am

Re: Development: Smarty function depending on cms_selflink

Post by philonor »

I solved the problem by checking for the existence of the depending function and - if it was not declared - including it via require_once:

function.cms_xyz.php

Code: Select all

if(!function_exists('smarty_function_cms_selflink'))
{
	require_once('function.cms_selflink.php');
}

function smarty_function_cms_xyz(...)
{
...
}
Post Reply

Return to “Developers Discussion”