Extra sitewide variables/configuration - where best to put them?
Hi, We're building a site for a client that's taking donations on a rolling basis. We'd therefore like to have e.g. the running total of donations stored in some centralized place that the client can update, and I was wondering where would be the right place to put that. Any ideas? Extra input fields on admin/settings/site-information would feel right, but I'm not sure how to hook into that or if so how to get at the additional content from within PHPTemplate. Best regards, J-P
AFAIK you can call variable_get() from the template.php file, than use http://api.drupal.org/api/5/function/_phptemplate_variables to "inject" the data. s On Wed, 16 May 2007 09:53:15 +0100 J-P Stacey <jp.stacey@torchbox.com> wrote:
Hi,
We're building a site for a client that's taking donations on a rolling basis. We'd therefore like to have e.g. the running total of donations stored in some centralized place that the client can update, and I was wondering where would be the right place to put that.
Any ideas? Extra input fields on admin/settings/site-information would feel right, but I'm not sure how to hook into that or if so how to get at the additional content from within PHPTemplate.
Best regards, J-P -- [ Drupal support list | http://lists.drupal.org/ ]
If you can use variable_get(), why not use variable_set() also? That seems the easiest to me, and it can be done anywhere - in a block, a node, the theme, etc. http://api.drupal.org/api/5/function/variable_set On Wednesday May 16 2007 4:16 am, sessy wrote:
AFAIK you can call variable_get() from the template.php file, than use http://api.drupal.org/api/5/function/_phptemplate_variables to "inject" the data.
s
On Wed, 16 May 2007 09:53:15 +0100
J-P Stacey <jp.stacey@torchbox.com> wrote:
Hi,
We're building a site for a client that's taking donations on a rolling basis. We'd therefore like to have e.g. the running total of donations stored in some centralized place that the client can update, and I was wondering where would be the right place to put that.
Any ideas? Extra input fields on admin/settings/site-information would feel right, but I'm not sure how to hook into that or if so how to get at the additional content from within PHPTemplate.
Best regards, J-P -- [ Drupal support list | http://lists.drupal.org/ ]
-- Jason Flatt http://www.oadaeh.net/ Father of Six: http://www.flattfamily.com/ (Joseph, 13; Cramer, 11; Travis, 9; Angela; Harry, 5; and William, 12:04 am, 12-29-2005) Linux User: http://www.kubuntu.org/ Drupal Fanatic: http://drupal.org/
Hi,
If you can use variable_get(), why not use variable_set() also?
Thanks for the replies. I'm after something that the client can make use of, so it would need to have a decent interface for changing the value: otherwise, I might as well hardwire it in the template! I don't really have time to learn the Form API for this project because of deadlines: should I just stick this data in a block, so the client can edit it, and then reference that in the code? Many thanks again, J-P
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 jp.stacey@torchbox.com schrieb:
Hi,
If you can use variable_get(), why not use variable_set() also?
Thanks for the replies. I'm after something that the client can make use of, so it would need to have a decent interface for changing the value: otherwise, I might as well hardwire it in the template!
I don't really have time to learn the Form API for this project because of deadlines:
IMNSHO you shouldn't been accepting Drupal based jobs if you don't know form API... WRT the subject: When I develop a site, there's usually a site specific module which holds all such extra stuff. Cheers, Gerhard -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFGSxIHfg6TFvELooQRAn/+AJ9pYy2R5vAZA5ibkwBJ3SgofAUWrwCgiO0/ VAevUEiMRqRwBk+BzKZam3U= =G4G3 -----END PGP SIGNATURE-----
Hi Gerhard,
When I develop a site, there's usually a site specific module which holds all such extra stuff.
Aha: we have a stubbed-out module with a handful of non-theme-specific functions. I've followed the tutorial at <http://drupal.org/node/82967> for adding config settings to that, and it seems to work fine. Thanks for the advice! Best regards, J-P
Hi, The Drupal site we've been building for a client has gone live, at http://crudemovie.net/ Thanks so much to everyone who helped on this list; and especially to Garrett, who came to give us a talk at work and offered help and assistance over email. As open-source experiences go, Drupal has been great, and we've been really impressed with the support we've got from the community. I hope to give an in-house developers' presentation in the next few days to spread the word. (Feedback appreciated, of course; be gentle, as we're still working out a few cross-browser niggles....) Cheers, J-P -- J-P Stacey +44 (0)1608 811870 http://torchbox.com
The last time I needed some site/theme specific variables, I developed a little one-off custom module called evergreen_settings. I made a settings form to access this information. I do think this is the best course of action. You do need to learn enough of the forms api to do develop a settings page. I then accessed these variable_gets from within my themes. If you're interested in going down this road, I'd be happy to share the module with you. You'd have to rename/customize it for your own site. Dave -----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of sessy Sent: Wednesday, May 16, 2007 4:17 AM To: support@drupal.org Subject: Re: [support] Extra sitewide variables/configuration - where best to put them? AFAIK you can call variable_get() from the template.php file, than use http://api.drupal.org/api/5/function/_phptemplate_variables to "inject" the data. s On Wed, 16 May 2007 09:53:15 +0100 J-P Stacey <jp.stacey@torchbox.com> wrote:
Hi,
We're building a site for a client that's taking donations on a rolling basis. We'd therefore like to have e.g. the running total of donations stored in some centralized place that the client can update,
and I was wondering where would be the right place to put that.
Any ideas? Extra input fields on admin/settings/site-information would
feel right, but I'm not sure how to hook into that or if so how to get
at the additional content from within PHPTemplate.
Best regards, J-P -- [ Drupal support list | http://lists.drupal.org/ ] -- [ Drupal support list | http://lists.drupal.org/ ]
participants (6)
-
Gerhard Killesreiter -
J-P Stacey -
Jason Flatt -
jp.stacey@torchbox.com -
Metzler, David -
sessy