View previous topic :: View next topic |
Author |
Message |
TirednBurntOut Smarty Rookie
Joined: 21 Nov 2014 Posts: 24
|
Posted: Fri Nov 21, 2014 1:12 am Post subject: Why would get_template _vars not work? |
|
|
Am using SmartJobBoard software.
Get this message when trying to use get_template _vars , either for a variable I know to exist, or to get all variables.
"Call to a member function get_template_vars() on a non-object" |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Nov 21, 2014 1:18 am Post subject: |
|
|
Simple Test Case? |
|
Back to top |
|
TirednBurntOut Smarty Rookie
Joined: 21 Nov 2014 Posts: 24
|
Posted: Fri Nov 21, 2014 1:36 am Post subject: |
|
|
Not sure what you are asking? I have poked and prodded quite a bit. In this SmartJobBoard package, the authors call get_template_vars twice, so I presume its "there".
I did find a function in the Smarty.class.php that starts with:
function &get_template_vars($name=null)
Note the ampersand. I presume they are modifying the built-in function.
But I am lost as to why I cant call get_template_vars |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Nov 21, 2014 5:24 pm Post subject: |
|
|
I'm asking for a simple test case demonstrating your issue. Noone going to google for "this SmartJobBoard", even less - install it and try to reproduce your problem. |
|
Back to top |
|
TirednBurntOut Smarty Rookie
Joined: 21 Nov 2014 Posts: 24
|
Posted: Fri Nov 21, 2014 5:44 pm Post subject: |
|
|
That's what I thought you meant. But this software is so convoluted, there is no way to strip it down. Quite unbelievable code. Sorry I bought the software.
In any case, I am pondering ways to test the funciton outside the software package. Looking for any way to isolate the problem. I am not familiar with smarty. Can you suggest a minimal install/configuration?
Thanks in any case. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Nov 22, 2014 12:46 am Post subject: |
|
|
If you've paid for it, it should have at least some form of support.
At least, that's what I would normally expect for paid work. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Nov 22, 2014 12:18 pm Post subject: |
|
|
function &get_template_vars($name=null) is a method of the Smarty class in Smarty2.
You must have called this method on a variable which is not the Smarty instance.
Provide the piece of code where you called it. |
|
Back to top |
|
TirednBurntOut Smarty Rookie
Joined: 21 Nov 2014 Posts: 24
|
Posted: Mon Nov 24, 2014 10:01 pm Post subject: |
|
|
U.Tews wrote: | function &get_template_vars($name=null) is a method of the Smarty class in Smarty2.
You must have called this method on a variable which is not the Smarty instance.
Provide the piece of code where you called it. |
I dont know if that will help. SmartJobBoard is a Smarty 2 based system, heavily dependent on it. In the original code, they call get_template_vars() twice, and I can see function &get_template_vars in the class file.
This software runs everything thru a very bare Index.php, so one would think that, as a simple test, echo $smarty->get_template_vars(); in Index.php would work, but it generates the error there as well as where I am actually trying to use it. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Nov 25, 2014 3:13 am Post subject: |
|
|
To me it looks like that the variable $smarty did not exist.
Maybe they used another variable name for the Smarty object. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Nov 25, 2014 8:03 pm Post subject: |
|
|
Or it does not exist in the scope you're trying to address it from. |
|
Back to top |
|
n0xor Smarty Rookie
Joined: 04 Dec 2014 Posts: 6
|
Posted: Thu Dec 04, 2014 5:36 pm Post subject: Re: Why would get_template _vars not work? |
|
|
TirednBurntOut wrote: | "Call to a member function get_template_vars() on a non-object" |
TirednBurntOut wrote: | "on a non-object" |
TirednBurntOut wrote: | "on a non-object" |
Let me point out that u are calling the function not on the smarty object. Could u pm me the output of a var_dump($smartyObject);? |
|
Back to top |
|
|