Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By petiar on
Hi everybody,
I am developing new module which should allow users to set up their own title and slogan for their blogs. What I don't know is how could I change the site_name and site_slogan variables inside my module without need to hack the page.tpl.php. I assume this will have something to do with the template preprocess but I am not very experienced with this yet. Can anyone think of any solution?
Thanks a lot,
Petiar.
Comments
variable
You can temporary set value of the following variable when someone visit particular blog (i dont know how you manage it , you can manage it through url or session)
variable_set('site_name', "YOUR BLOG NAME");
variable_set('site_slogan', "YOUR SLOGAN");
--
Kuldip Gohil
Software Engineer - Global Software Consulting (Gloscon)
1-888-DRUPAL-9 (378-7259)
http://www.gloscon.com
How do you mean 'temporary'?
I am afraid
variable_set
function updates persistent variables and updates db, so if I use this command I'll actually overwrite settings for whole website that means users browsing other than blog pages will see these variables changed as well. Or am I missing anything? Anyway, thanks for reply!--
Petiar
The biggest slovak folk music magazine proudly uses Drupal
http://folk.sk
--
Petiar
http://petiar.sk
Solution?
I've found out that site_name is being kept in
$GLOBALS['conf']['site_name']
and as such can be easily overwritten. However, it looks like bit dodgy way of coding - overwriting global vars.Does anyone has got any other idea?
Thanks.
--
Petiar
The biggest slovak folk music magazine proudly uses Drupal
http://folk.sk
--
Petiar
http://petiar.sk
I have a similar need, and
I have a similar need, and thanks for pointing out GLOBALS. If you find a better way, though, please post here.
TAA