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

initiate register function and modifier

 
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
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Tue Aug 31, 2010 4:12 am    Post subject: initiate register function and modifier Reply with quote

Do I have to, first manually register (plugins) modifiers and functions now? ,

I copied my old modifiers/functions and custom plugins and they aren't working.

Also what is the proper way to initiate the new register object? for example accesing:


$smarty->register->modifier();

Fatal error: Call to a member function modifier() on a non-object


Didn't find that info in the READ ME notes
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Tue Aug 31, 2010 8:23 am    Post subject: Reply with quote

spent quite a few hours trying to move things around, but I once again decided to hold up until a stable version is released. Too many unexpected things generated error.

I think the register object should be initiated on the Smarty constructor (didn't seem like it, there wasn't even a constructor). I guess here is where the __autoload plays it's role. However the error handler wasn't helping either; except for generic excerptions, I guess i should of have disable it...
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


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

PostPosted: Tue Aug 31, 2010 1:51 pm    Post subject: Reply with quote

you should not have to register plugins in the plugin dir. make sure your paths are correct. read the README and Smarty 2->3 upgrade notes.

http://smarty-php.googlecode.com/svn/branches/Smarty3Dev/distribution/
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Tue Aug 31, 2010 6:14 pm    Post subject: Reply with quote

I have read the READ ME file and the SMARTY2_BC_NOTES as well, however they do not solve the problem, they do point out things that I've already taken in consideration.


The register object itself does not seem to exist (for whatever reason). There for causing a fatal error when trying to register a modifier or function, I had about 5 modifiers registered (in addition to the plugins).
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


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

PostPosted: Tue Aug 31, 2010 6:24 pm    Post subject: Reply with quote

This should work:

$smarty->register->modifier($modifier_name, $modifier_impl);

Do you get an error when you run that? The register object gets created on the initial call.
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Wed Sep 01, 2010 12:11 am    Post subject: Reply with quote

mohrt wrote:
This should work:

$smarty->register->modifier($modifier_name, $modifier_impl);

Do you get an error when you run that? The register object gets created on the initial call.

Yes. That is what i been trying to say. It dies with a fatal error when I tried to. I do have an autoload function in my code but I had replaced it with a spl_autoload_register stack function.

when trying to extend smarty 3 is this:

Fatal error: Call to a member function convert() on a non-object in Smarty-3.0rc3\libs\Smarty.class.php on line 763

conver() a method is inside the Smarty_Internal_Wrapper class, which is assumed to be included in sysplugins/smarty_internal_wrapper.php

the next error(s) would be , register is not an object
_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Wed Sep 01, 2010 12:41 am    Post subject: Reply with quote

On __call function

Code:
   public function __call($name, $args)
    {
      / /.......................................
        // Smarty Backward Compatible wrapper
        if (!isset($this->wrapper)) {
            $this->wrapper = new Smarty_Internal_Wrapper($this);
        }
        return $this->wrapper->convert($name, $args);
    }
}


if "$this->wrapper" is renamed to something else, then this specific error goes away.

Code:
Fatal error: Call to a member function convert() on a non-object in Smarty-3.0rc3\libs\Smarty.class.php on line 763

_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET


Last edited by cjxxi on Wed Sep 01, 2010 12:58 am; edited 5 times in total
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
mohrt
Administrator


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

PostPosted: Wed Sep 01, 2010 12:42 am    Post subject: Reply with quote

are you using php 5 __construct() when extending smarty?
Back to top
View user's profile Send private message Visit poster's website
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Wed Sep 01, 2010 12:44 am    Post subject: Reply with quote

mohrt wrote:
are you using php 5 __construct() when extending smarty?


Yes , yes i am :

Code:
   function __construct()
   {
      parent::__construct();
      $this->compile_dir = APP_ROOT_BASE.'cache';
   }

_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
cjxxi
Smarty Regular


Joined: 03 Aug 2007
Posts: 40
Location: Fort Worth,Texas

PostPosted: Wed Sep 01, 2010 12:59 am    Post subject: Reply with quote

I think defining $wrapper on top of the class solves the first problem

Code:
class Smarty extends Smarty_Internal_Data {
    // smarty version
    const SMARTY_VERSION = 'Smarty3-RC3';
   
    public $wrapper;

_________________
CJAX THE PHP AJAX FRAMEWORK AT CJAX.NET
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
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