|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Sep 24, 2015 7:03 pm Post subject: |
|
|
addPluginsDir() does append your custom plugins folder to the search order. So Smarty will find its default modifier first.
Use setPluginsDir() and place you folder first in array().
See http://www.smarty.net/docs/en/api.set.plugins.dir.tpl |
|
Back to top |
|
ildar Smarty Rookie
Joined: 14 May 2015 Posts: 14
|
Posted: Fri Sep 25, 2015 6:10 am Post subject: |
|
|
Thank you.
Your solution is working
The changed code is
Code: | public function __construct()
{ //{{{
parent::__construct();
$this->setPluginsDir(array_merge(
array(__DIR__ . '/custom_plugins'),
$this->getPluginsDir()
));
.......
|
Last edited by ildar on Fri Sep 25, 2015 2:35 pm; edited 1 time in total |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Sep 25, 2015 9:41 am Post subject: |
|
|
ildar wrote: |
Thank you.
Your solution is working
The changed code is
Code: | public function __construct()
{ //{{{
parent::__construct();
$this->setPluginsDir(array_merge(
array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'custom_plugins'),
$this->getPluginsDir()
));
.......
|
|
You know other directory separators, than "/"? Seriously? What OS, may I ask? |
|
Back to top |
|
ildar Smarty Rookie
Joined: 14 May 2015 Posts: 14
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Sep 25, 2015 2:19 pm Post subject: |
|
|
First, it is not "PHP", it is "Operating System" (in this case Windows) don't make a difference between "/" and "\" as path separators.
Second, yes, it is useful, when you are calling system functions and deal with their return values.
Here you are not calling system function.
Third, code readability also matters.
array(__DIR__ . '/custom_plugins')
is more readable, than
array(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'custom_plugins'), |
|
Back to top |
|
ildar Smarty Rookie
Joined: 14 May 2015 Posts: 14
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|