On Jun 10, 6:44 pm, SamDonaldson <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'd like to be able to set some global server variables such as my
> package path so that it's easily accessible from anywhere in my code.
> I'd like to be able to store a path to my images directory etc.. How
> do I do this. I'm trying to set a variable in my dev.cfg but I can't
> see that variable name in any of my controller or model files etc..
>
> Also, do anybody know how to get the package path at all times so that
> I don't have to hardcode it? I need to be able to get this from any
> controller. Isn't there some variable that gives this to us?
I can answer the second question. In your controller you can use the
function turbogears.url() to convert a relative URL to an absolute
one. So turbogears.url('/index') would give you the absolute URL of
your '/index' page. In templates tg.url will give you the absolute
root of your site. See:
http://docs.turbogears.org/1.0/GettingStarted/URLs
--
Bruce Webber
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---