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

Error: Beta6: _get_plugin_filepath

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
m-g
Smarty Rookie


Joined: 12 Jan 2010
Posts: 6
Location: Germany

PostPosted: Tue Jan 12, 2010 12:49 pm    Post subject: Error: Beta6: _get_plugin_filepath Reply with quote

I am using some additional Smarty plugins (e.g. imagetext, ...). With Smarty2 all works fine, but after upgrading and testing with Smarty3 beta 6 I got:

Exception: Undefined Smarty method "_get_plugin_filepath"
due to the following line:
require_once $smarty->_get_plugin_filepath('shared','imagetext');

Is there anything to adjust? Or is this obsolete and the plugin needs a rewrite?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jan 12, 2010 3:24 pm    Post subject: Reply with quote

If the plugin uses anything internal to Smarty 2, it likely will not work with Smarty 3 without some adjustments.
Back to top
View user's profile Send private message Visit poster's website
m-g
Smarty Rookie


Joined: 12 Jan 2010
Posts: 6
Location: Germany

PostPosted: Mon Jan 18, 2010 8:23 am    Post subject: Reply with quote

Here a solution to get "_get_plugin_filepath" running with v2 and v3:
Code:

    if (method_exists($smarty, '_get_plugin_filepath')) {
        //handle with Smarty version 2
        require_once $smarty->_get_plugin_filepath('shared','imagetext');
    } else {
        //handle with Smarty version 3
        foreach ($smarty->getpluginsdir($smarty) as $value) {
            $filepath = $value ."/shared.imagetext.php";
            if (file_exists($filepath)) {
                require_once $filepath;
            }
        }
    }
Back to top
View user's profile Send private message
m-g
Smarty Rookie


Joined: 12 Jan 2010
Posts: 6
Location: Germany

PostPosted: Fri Mar 05, 2010 5:40 pm    Post subject: now ready for Smarty Beta 8 Reply with quote

Because
Quote:
$smarty->getpluginsdir($smarty)

is no longer available in Smarty 3 Beta 8, the plugin must be changed again:
Code:

    if (method_exists($smarty, '_get_plugin_filepath')) {
        //handle with Smarty version 2
        require_once $smarty->_get_plugin_filepath('shared','imagetext');
    } else {
        //handle with Smarty version 3 beta 8
        foreach ($smarty->plugins_dir as $value) {
            $filepath = $value ."/shared.imagetext.php";
            if (file_exists($filepath)) {
                require_once $filepath;
            }
        }
    }

Or fell free to download the new version from sourceforge https://sourceforge.net/projects/imagetext/
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 -> Smarty 3 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