"Variables" is the term used in Drupal for persistent variables, which are the variables set with variable_set().
2
votes
1answer
20 views
Is there a variable that keeps track of which pages are enabled or disabled in Page Manager?
I'm using the Features module and I'm tired of manually enabling/disabling pages (user_edit, user_view, etc.) Is there a variable that I can add to Strongarm to control this in code?
1
vote
1answer
27 views
Site wide information data
I'm using many information data on my site. I have some blocks with the main informations like address and phone numbers, but also I have some blocks with Quick Response code, geolocations (latitude, ...
2
votes
2answers
67 views
Trying to make a custom region disappear upon user login, then reappear when user logs out
I've looked everywhere for an answer to my problem, but can't find one. My goal is to collapse/force a custom region on my website to disappear when a user logs in, and then have it reappear when the ...
3
votes
1answer
35 views
Conflict with db_set_active and variable_get
I am running a drupal multi-site system, with shared code and seperated DB. Each individual multi-site represents one continent and can have different language versions.
What i want:
I am working on ...
0
votes
2answers
34 views
D6 - Trying to display variable_get()s in a block
I am trying to display 4 variables in a custom block(created from my custom module). I am accessing the variables using variable_get('$myvariable', '0').
I am not able to display the array in the ...
0
votes
3answers
56 views
Unable to save variable(s) from a custom form
I want to create a custom form with a few textfields and then use variable_set to save those textfields as variables.
I am not able to save the variable with the code below.
Question: I do not see ...
0
votes
1answer
33 views
Unable to set and display variable in theme
I've got the following snippet in my template.php file, using Drupal 7:
function mytheme_preprocess_page() {
global $variables;
$variables['user_full_name'] = "Joe Soap";
}
and trying to ...
1
vote
1answer
111 views
Correct way of passing variables between hook and tpl.php
I asked a similar question a few months ago, but the truth is that there is very little information about the correct way of doing this.
The simplest way is to use the arg() function, but as the docs ...
0
votes
1answer
54 views
Can you display a variable in a Drupal webform component label?
I'm trying to create a webform in Drupal 6 where the label of a select webform component is rendered using the contents of a variable. For example:
client_name = "Starbucks"
and I would like the ...
4
votes
1answer
65 views
Get site_name without html
I've got a custom module that is sending some emails and I want to put the site name in the subject line, but whenever I look up the site_name in code, it is wrapped in html.
This is the code I use ...
0
votes
1answer
10 views
Is there anything like attached data storage for a view?
I'm having hard time using Views with i18n Views. What gets me very irritated is that the translations of global fields (headers, footers, etc.) get lost whenever I make changes to that View. I would ...
0
votes
3answers
93 views
How to pass variables between theme functions
I often use functions that contain variables in the following files:
Template.php
Custom Panels Style Plugins
node.tpl.php files
field.tpl.php files
views.tpl.php files
I often needed to pass ...
0
votes
0answers
55 views
Fatal Error: Undefined function variable_get();
I have this, $metrics = variable_get('rbi_metrics_list_settings',array());, I have used this in 3-4 pages. And when I put in another file, when I wanted to see what's inside of $metrics , it said ...
0
votes
1answer
154 views
Only variables should be passed by reference in faq_ask_node_insert() [closed]
I get this strict warning when I ask a question in faq_ask module: Strict warning: Only variables should be passed by reference in faq_ask_node_insert(). The PHP file is faq_ask module and the path to ...
0
votes
0answers
39 views
Drupal 7 looking for css_js_query_string as url?
When I load user pages (but not admin pages), I'm getting a 404 at http://site.com/&mcnqv4. When I search the database, it finds one match of that string, which is the variable table -> ...
1
vote
1answer
61 views
What's overriding my local_settings.php?
I'm using a local_settings.php file, that includes several $conf settings. All of the settings were working as expected until just recently when the mail_system setting started getting overridden ...
1
vote
1answer
50 views
variable_get with prefix
It's there a chance to retrieve all key/value, stored in variable table, that have a prefix, using variable_get()?
e.g: variable_get("prefix_*")
Or I have to use db_select('variable')?
2
votes
3answers
117 views
From where does variable_get() get the first parameter?
function variable_get($name, $default = NULL) {
global $conf;
return isset($conf[$name]) ? $conf[$name] : $default;
}
From where does variable_get() get the first parameter?
2
votes
1answer
98 views
Global site variables to be used in node fields and menu item
I'm looking for some way of having variable defined by admin which can be displayed in some fields or nodes.
Real use case:
I have that specific date that changes periodically. And I want it to ...
0
votes
1answer
223 views
Variable_get question default value in form
So I am reading Drupal Development Pro 7 and have stumbled upon something I am a little bit unsure about to do with the variable_get function & form element. I understand it retrieves a stored ...
0
votes
0answers
165 views
How do I free a variable set using variable_set()?
I have used variable_get(), and variable_set() in my form search, but when I visit another page, and come to the module again, it shows the previous results. How can I free the variable at the time of ...
3
votes
2answers
688 views
How to add variables to $conf array?
To modify some default settings for the Feeds module, I need to set a variable in the $conf array. What is the right way to achieve this?
I've tried adding it in the settings.php file (currently on ...
0
votes
1answer
224 views
In a custom module, what is the most elegant way to pass variables between functions?
** I have updated this post with my solution to the problem. See at the bottom of this post. **
I am writing a custom ajax contact module. It's fairly simple at this point, doesn't have any sort of ...
0
votes
1answer
368 views
variable_get/set not working right
I am using drupal 6. I have a variable in a function which I saved with variable_set. I called variable_get in a different function and it keeps giving me the default. Why wont it save the variable? I ...
0
votes
1answer
201 views
Why do I have to add main-menu under features[] in the theme info file?
I have seen other themes that just define regions and then use drupals theme() function in the page.tpl.php to print the Main menu wherever the developer pleases.
This was not the case for me, and I ...
0
votes
1answer
153 views
how to set a variable in module and get it in theme
i want set a variable in module and use it in my theme,
(except variable_set and variable_get way.)
for instance . in module file
if(in_array(arg(1),$ex))
{
// set a variable
...
2
votes
1answer
208 views
Form API + Module: Nested default value variable_get doesnt behave the same as unnested variable_get
Heres the example code:
function mymodule_form($form, &$form_state){
$form['nest'] = array(
'#type' => 'fieldset',
'#title' => t('Nested settings'),
'#tree' ...
1
vote
3answers
578 views
How does Drupal find contributed modules and themes?
I have a development site with a peculiar problem Although the contributed modules and themes are in their proper place under sites/all/modules (& themes) I am getting an error message that says ...
2
votes
3answers
149 views
Default value to drupal variable
I have a piece of code that I want to have the default value be a variable, but I need to know how to set a default value if the variable is not set:
$form['background_audio_height'] = array(
...
0
votes
2answers
92 views
Custom Page type and variables
In my preprocess_page() function, I'm setting variables based on the user that is logged in.
I created a custom page that is used as a Welcome page with the information about the user that I set in ...
2
votes
2answers
46 views
How can I get documentation on a variable listed in the Features UI provided by Strongarm?
When looking through the list of variables provided by Strongarm, there are several that sound like they might be useful to include but what they actually refer to is impossible to guess from the name ...
2
votes
1answer
212 views
How to optimize the unserialization of “variables” cache value
As we all know, the whole variable table is being cached in the drupal cache system and is being extracted into global $conf variable in each invoke. In one of our production site with the domain ...
1
vote
1answer
346 views
File Upload form issue
I have been working on this code and I am having some errors, and I was wondering if anybody can find errors in this code... I have posted my error below it...
function background_audio_form($form, ...
1
vote
1answer
55 views
Form Submit Issue
Below is my form submit statement for my site. I know that the query works by it self however it does not seem to be setting the variable correctly. Does anybody see why this would not work, or am I ...
1
vote
2answers
203 views
db_query to drupal variable
I have a the following query:
function background_audio_file_query($path) {
$result = db_query("SELECT uri
FROM `file_managed`
WHERE `filemime` = 'audio/mpeg'
LIMIT 1 , 30",
...
2
votes
2answers
753 views
Using variable_get() in multiple places, without duplicating $default
When using variable_get() in multiple places, how should one avoid duplicating the $default values?
define()? Or is there some built-in Drupal-specific mechanism I'm missing?
1
vote
1answer
176 views
Why doesn't variable_set() work in an installation profile?
I'm writing an installation profile, and I want to display some forms on some pages. The form below intended to set a variable at submission time. It does not work in the profile, but it works on an ...
1
vote
1answer
316 views
What's the difference between globals $base_root and $base_url
Can't seem to find the difference between these. D6 is what I need to know, but would love to know how those looks into 7 and even 8.
6
votes
2answers
445 views
How to export translated variables settings in code?
In a custom module I define several configuration variables by implementing the Variable module's API. The module is part of a multilingual site project, so some of these variables should be ...
0
votes
1answer
73 views
Fields UI export to code for editing?
I am creating a new registration form with the Fields UI module and need to
be able to add variable_get instances for username, email, etc and also add
select lists for birthday info, typical drop ...
0
votes
1answer
230 views
How can I set a variable in the body of a node?
In Drupal 7 I've created a node of type basic page.
Then in Body field I've inserted some markup mixed with php code.
Then this was saved in PHP text format.
In the above mentioned markup I have ...
3
votes
2answers
598 views
variable_get() using “default value” with no reason in Pressflow 6
I'm currently having a problem with variable_get() that sometimes with no reason, returns the default value instead of the one from the database.
I'm using memcached here (and the Drupal memcached ...
2
votes
2answers
3k views
Pass arguments using hook_menu
I would build a confirmation screen. So I initialized the path in the hook_menu as it should be but for some reason, the argument $node isn't send with the function... What am I doing wrong?
This is ...
1
vote
0answers
567 views
How do I create a Drupal 7 multilanguage frontpage including SEO?
What is the best solution for creating a multi language homepage with Drupal 7?
I am using the modules 'Meta tags, 'Internationalization' and 'Variable'.
In the Multilingual setting ...
3
votes
2answers
116 views
Where are Cache settings stored?
I assumed the settings from the function system_performance_settings were stored in variables, but couldn't figure out which.
2
votes
2answers
1k views
How to access Drupal variables in a PHP included file?
I have a snippet of HTML that I've saved in my theme as mysnippet.inc. I'm using this code in template files (eg. node.tpl.php) to include it:
<?php include($directory."/includes/mysnippet.inc"); ...
1
vote
1answer
184 views
Correct Syntax for $conf to populate Varnish Control Terminal
This may be more a php question, but pertains to Drupal, so here goes: I'm trying to configure Varnish Control Terminal to use multiple hosts using settings.php. I have:
...
0
votes
1answer
140 views
Localizable text in custom layout?
I'm customizing Display Suite-suggested tpl by adding "Jump to top" links at the bottom of each teaser and I want to properly localize the link text.
Now I am unclear as per the usability of the ...
1
vote
2answers
461 views
How to create a module wide variable that refreshes every page load?
What is the best way to create a variable that is accessed by the different views of my module (block, page etc), but that is destroyed at every new page request?
I've been using variable_set to ...
1
vote
3answers
125 views
Outputting node fields individually
I have a node template but instead of outputting $content, I want to have more control over what the template displays by printing each field individually.
Below are the fields I want to include:
...