You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by "Hicks, Bob" <BH...@osc.uscg.mil> on 2005/04/29 18:13:49 UTC
Question on scope (not the mouthwash) and another
I am mucking around with rivet at work.
I have an index.tcl file with:
set titleMain "The title is main"
parse index.rvt
The file index.rvt has 3 includes:
<? include tpl/header.tpl ?>
<? include tpl/main.tpl ?>
<? include tpl/footer.tpl ?>
The main.tpl actually has the place where I want to put <? $titleMain ?>,
but when I run it everything shows up except for the titleMain part. Does
Rivet(tcl) file only pass variables to the file it parses?
The second question would be how do I get the URL param (i.e.
page=thispage)? Would that be something like:
if {load_header eq "thispage"} {
# do something
} elseif {load_header eq "thatpage" {
# do something
}
Bob
Re: Question on scope (not the mouthwash) and another
Posted by Karl Lehenbauer <ka...@sc.com>.
On Apr 29, 2005, at 11:13 AM, Hicks, Bob wrote:
> I am mucking around with rivet at work.
>
> I have an index.tcl file with:
>
> set titleMain "The title is main"
> parse index.rvt
>
> The file index.rvt has 3 includes:
>
> <? include tpl/header.tpl ?>
> <? include tpl/main.tpl ?>
> <? include tpl/footer.tpl ?>
>
> The main.tpl actually has the place where I want to put <? $titleMain
> ?>, but when I run it everything shows up except for the titleMain
> part. Does Rivet(tcl) file only pass variables to the file it parses?
Is titleMain a variables that contains something you want to execute?
If so, you probably need to do
puts [$titleMain]
If it just contains what you want to emit for your title,
puts $titleMain
or
puts stdout $titleMain
...unless I misunderstand your intent.
Rivet doesn't automatically emit stuff returned from functions into the
webpage.
>
> The second question would be how do I get the URL param (i.e.
> page=thispage)? Would that be something like:
>
> if {load_header eq "thispage"} {
> # do something
> } elseif {load_header eq "thatpage" {
> # do something
> }
There is a thing called load_response that will load the URL parameters
if they're there, or the parameters sent when it's a POST. If you
don't specify the array name, it defaults to "response". There might
be some other way to do it (that load_response actually uses) but I'm
not recalling it off the top of my head.
>
> Bob
Karl