ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to access user defined global variables from module

June 10, 2009 9:51pm

Subscribe [1]
  • #1 / Jun 10, 2009 9:51pm

    Paul Bland

    25 posts

    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

    Greg Aker

    6022 posts

    paul,

    I’m not really following your question.  Are you trying to use it in your addon?

    -greg

  • #3 / Jun 10, 2009 10:06pm

    Paul Bland

    25 posts

    Yes I need to access it from the module. (The php file, not the template).

  • #4 / Jun 10, 2009 10:14pm

    Greg Aker

    6022 posts

    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

    Paul Bland

    25 posts

    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

    Lisa Wess

    20502 posts

    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

    Paul Bland

    25 posts

    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

    Lisa Wess

    20502 posts

    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.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases