Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty running okay except not finding custom plugins

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup
View previous topic :: View next topic  
Author Message
jamminjames
Smarty Rookie


Joined: 26 Dec 2018
Posts: 5

PostPosted: Wed Dec 26, 2018 11:06 pm    Post subject: Smarty running okay except not finding custom plugins Reply with quote

I have Smarty set up correctly, I think, but custom plugins in the /plugins folder don't seem to be recognized. I am running it in a Xampp localhost setup on a Windows machine.

I have it set up as in the demo folder structure, with /configs /plugins and /templates as subfolders of the main project folder.

Smarty finds the templates just fine in the /templates folder. For example, in one project file, I have:
Code:
$smarty->display('renewal-text-display.tpl');

and it finds it.

However, I have a block.php_code.php function file in /plugins, and trying to use the tag {php_code} from it in a template file, but the error I get seems to be saying it's looking in the lib/Smarty/libs/sysplugins folder when I call it. The error is:

Quote:
unknown tag 'php_code' in C:\[my_project_folder]\lib\Smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php


Shouldn't it automatically look in the [my_project_folder]\plugins folder if Smarty is set up correctly?

I tried using
Code:
$smarty->setPluginsDir('./plugins');
in the script file, but then it looks for Smarty's system plugins there too.

Any help would be appreciated. Thank you!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Thu Dec 27, 2018 10:39 am    Post subject: Reply with quote

Don't use relative paths!
Don't use relative paths!
Don't use relative paths!
Don't use relative paths!
Don't use relative paths!
Don't use relative paths!

Use absolute paths unless you 100% know what you are doing. Even then, relative paths are probably a bad idea.
Back to top
View user's profile Send private message
jamminjames
Smarty Rookie


Joined: 26 Dec 2018
Posts: 5

PostPosted: Fri Dec 28, 2018 6:51 am    Post subject: Set it up once, so it can find everything Reply with quote

But I have the line:
Code:
define('SMARTY_DIR', 'C:/xampp/apps/wordpress/subs.ht.new/lib/Smarty/libs/');

which should set it up so that relative paths can work, if the folders are in the right places, yes?

I found the problem, though. Looking at the Demo folder structure, I assumed the /plugins folder should go under the main project folder, like the /template folder. But upon reading further, I see it looks for it under the main Smarty folder. It's working now, thanks!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jan 01, 2019 4:17 am    Post subject: Re: Set it up once, so it can find everything Reply with quote

jamminjames wrote:
But I have the line:
Code:
define('SMARTY_DIR', 'C:/xampp/apps/wordpress/subs.ht.new/lib/Smarty/libs/');


Not related.

Quote:
I found the problem, though. Looking at the Demo folder structure, I assumed the /plugins folder should go under the main project folder, like the /template folder. But upon reading further, I see it looks for it under the main Smarty folder. It's working now, thanks!

No.
Don't screw the Smarty directories.
1. Use absolute paths.
2. Use your own path for your own plugins.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Installation and Setup All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP