|
|
#1 |
|
Member
|
Hi All
I have been commisioned to create a simple module for 68, allowing ONLY administrators to be able to create and manage advertising banners. Everything is working as it should be bar one thing - in Module Requirements it states that "...The plugins directory is the place for Smarty plugins.." Having placed my custom plugin into this directory, the front site load fails, because it cannot find the plugin to use {getadvert location="1"}. Without dropping the plugin directly into the includes/classes/smarty/plugins directory, how do i get the template engine to see the modules plugin dir? The only place i can find that seems to specifiy how additional plugin dirs are included in in includes/classes/kernal/Template.php, and the class constructor can take an additional parameter called module, which then goes on to check in the modules dir for available plugin dirs. (lines 67 - 71) But since there is only one instance of the template class, and it doesnt take the module name param during the init, then Smarty cannot know about my modules/adme/plugins directory. Has anyone else noticed this problem, or am I missing something that loads the plugin dir into Smarty? I would appreciate any comments or help on this as I have come to a complete stand still! Regards Ben |
|
|
|
|
|
#2 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
I would have to double check this. But I believe the module/plugin directory is only called when viewing the index.php or admin.php file within the module.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#3 |
|
Member
|
Hi again
Please disregard the last post. I have added a small check at the start of the load in the admin area that tests for the existance of the plugin in the smarty/plugins dir and if it does not find the file then it copies the plugin into the dir thus: Code:
$testforplugin = '../includes/classes/smarty/plugins/function.getadvert.php';
$sourcepath = '../modules/adme/plugins/function.getadvert.php';
$destinationpath = '../includes/classes/smarty/plugins/function.getadvert.php';
if(!file_exists($testforplugin)){
if(!copy($sourcepath,$destinationpath)){
die("Could not copy the required plugin to $destinationpath");
}
}
PS: If you can see any problems with the solution i have come up with please let me know! Ben Last edited by marketingsolutions; 03-12-2008 at 09:18 AM. |
|
|
|
|
|
#4 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
Ben,
I don't see any issues right off with doing that. Actually pretty nice outside the box thinking.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Smarty Templates and You. Posted BY Lhotch | Eric Barnes | HTML, CSS, and Design Help | 13 | 10-02-2007 08:06 AM |