View previous topic :: View next topic |
Author |
Message |
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Tue Aug 31, 2010 4:12 am Post subject: initiate register function and modifier |
|
|
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 |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Tue Aug 31, 2010 8:23 am Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
Back to top |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Tue Aug 31, 2010 6:14 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Aug 31, 2010 6:24 pm Post subject: |
|
|
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 |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Wed Sep 01, 2010 12:11 am Post subject: |
|
|
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 |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Wed Sep 01, 2010 12:41 am Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Sep 01, 2010 12:42 am Post subject: |
|
|
are you using php 5 __construct() when extending smarty? |
|
Back to top |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Wed Sep 01, 2010 12:44 am Post subject: |
|
|
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 |
|
cjxxi Smarty Regular
Joined: 03 Aug 2007 Posts: 40 Location: Fort Worth,Texas
|
Posted: Wed Sep 01, 2010 12:59 am Post subject: |
|
|
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 |
|
|