Hi,
I am trying to work out how to access the user defined global variables (the ones created from the Templates tab) from within the module mcp file.
Thanks,
Paul
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
June 10, 2009 9:51pm
Subscribe [1]#1 / Jun 10, 2009 9:51pm
Hi,
I am trying to work out how to access the user defined global variables (the ones created from the Templates tab) from within the module mcp file.
Thanks,
Paul
#2 / Jun 10, 2009 9:59pm
paul,
I’m not really following your question. Are you trying to use it in your addon?
-greg
#3 / Jun 10, 2009 10:06pm
Yes I need to access it from the module. (The php file, not the template).
#4 / Jun 10, 2009 10:14pm
mysql> select * from exp_global_variables;Will show you what you have, and you can grab based on the site_id & variable_id as you need.
-greg
#5 / Jun 10, 2009 10:27pm
Ah, ok. I am using $DB->query() to get them straight from the DB, but I thought there might be a function for it, something like $TMPL->fetch_global(‘variable_name’);.
Thanks,
Paul
#6 / Jun 10, 2009 10:35pm
Template tags/variables are intended to be used in the templates not in the module files. You should re-examine what you’re doing and find another way to accomplish it.
#7 / Jun 10, 2009 10:50pm
I am writing a module to allow a user to choose a template from the site and send it to a group of users as an HTML email. It is a regular newsletter sent to subscribers of a magazine with a selection of latest news stories. I am storing the newsletter reply-to address and subject line as global variables.
Is there a better way to do this?
#8 / Jun 10, 2009 10:53pm
You would be better to have a module control panel and have that information entered into its control panel, where you can then programatically access it.