Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Calling config vars using dot-notation.

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
syntruth
Smarty n00b


Joined: 18 Aug 2003
Posts: 2

PostPosted: Mon Aug 18, 2003 10:10 pm    Post subject: Calling config vars using dot-notation. Reply with quote

Hiyas,

I'm running into an interesting issue, and I've poured over the forums looking for an answer and have found none.

My site always pulls the main template using fetch() in which I then display between my header and footer templates using display(). I use fetch, so that the template can generate a variable for me based on smarty logic in that template, namely, the variable I use for the generated page's title. On one template, I am trying to generate the title based on options in a config file, thus I am trying to pull the value using the dot-notation form for config vars, however it keeps coming up empty. The strange thing though, is that all calls using the hash-notation work just fine! Here is my code:

Code:

{config_load file="boards.conf" section=$board scope=global}

{if $cmd == "post"}
        {assign var="HWTitle" value="`$HWTemplate.config.BoardName` :: Post"}
        ....


Below that, I am using {#BoardName#} with no trouble at all. What I get out of that is the back-ticks displayed: "`` :: Post"

I was using version 2.4.2, but have just upgraded to 2.5.0, but still no luck. I even moved the $ in and out of the backticks. Is there something I am totally missing here? (If it matters, this is on linux.)
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Mon Aug 18, 2003 10:28 pm    Post subject: Reply with quote

- backticks where introduced with 2.5.0, you'll have no luck with them in 2.4.2.

- is your php-object called $HTTemplate? no matter how it's called in php the special variable in the template is always called $smarty so maybe you mean:
{assign var="HWTitle" value="`$smarty.config.BoardName` :: Post"}{$HWTitle}'

(with 2.5.0, 2.4.2 does neither know backticks nor the (virtual) $smarty.config-array)

HTH
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
syntruth
Smarty n00b


Joined: 18 Aug 2003
Posts: 2

PostPosted: Mon Aug 18, 2003 11:48 pm    Post subject: Reply with quote

Hmmm, well changing it to $smarty.config.BoardName worked just fine, *after* I made sure to get 2.5.0 installed -- a blanket copy did not work, and if I had just stopped and thought about it, I could have saved myself some forehead smacking. Wink

It would be nice if using $template_obj.config.whatever would have worked, so that I can have consistancy in my naming scheme.

I'm gonna look at a way to copy the {$smarty} object into a template var name... I'm sure it can be done. Smile

Thanks for the help!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP