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

Why would get_template _vars not work?

 
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 -> General
View previous topic :: View next topic  
Author Message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Fri Nov 21, 2014 1:12 am    Post subject: Why would get_template _vars not work? Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Nov 21, 2014 1:18 am    Post subject: Reply with quote

Simple Test Case?
Back to top
View user's profile Send private message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Fri Nov 21, 2014 1:36 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Nov 21, 2014 5:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Fri Nov 21, 2014 5:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sat Nov 22, 2014 12:46 am    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Sat Nov 22, 2014 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
TirednBurntOut
Smarty Rookie


Joined: 21 Nov 2014
Posts: 24

PostPosted: Mon Nov 24, 2014 10:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Tue Nov 25, 2014 3:13 am    Post subject: Reply with quote

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
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Nov 25, 2014 8:03 pm    Post subject: Reply with quote

Or it does not exist in the scope you're trying to address it from.
Back to top
View user's profile Send private message
n0xor
Smarty Rookie


Joined: 04 Dec 2014
Posts: 6

PostPosted: Thu Dec 04, 2014 5:36 pm    Post subject: Re: Why would get_template _vars not work? Reply with quote

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
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 -> General 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