[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: interpolation question
Quoting Kyle Hayes (kyle540@quicknet.net):
> Hi,
>
> I have a fairly lengthy database lookup that I am trying to do once on the
> first page the user sees from MV. I tried this:
>
> [perl values interpolate=1]
> $Safe{values}{private_label_name} = '[data ...]';
> return '';
> [/perl]
>
> And then I use this later in the code like this:
>
> [value private_label_name] thanks you for shopping...
>
> There is a problem. I did some checks, and what happens is that the
> session value ends up with the string:
>
> [data ...]
>
> instead of the value I expected. If I put the [data ...] line directly in
> the HTML, I get what I want.
>
> I tried setting a scratch variable:
>
> [set private_label_name][data ...][/set]
>
> and then used it:
>
> [scratch private_label_name] thanks you for shopping...
>
> and again I get:
>
> [data ...] thanks you for shopping...
>
> Not at all what I wanted.
>
> How do I force interpolation? I want to perform the database lookup
> _once_ and then store the value as either a session value or a scratch
> variable.
>
The important thing to know is that you cannot mix positional and named
parameters in Minivend tags. So [value private_label interpolate=1]
doesn't do anything like you are expecting -- it just shows the value
of private_label.
Certainly the easiest and most efficient way to do what you apparently
need is:
[value name=private_label set='[data ....]' ]
Add a "hide=1" if you don't want it coming back to the page.
And whatever you do, don't think [value private_label set="[data ...]"] is
the same....8-)
Then, of course you reference it as [value private_label].
Different tags have different interpolate defaults; [set ...] ... [/set] in
particular needs to NOT interpolate by default because its most common
use is to set one-click actions or search profiles. It
needs to be
[set name=something interpolate=1]
[sometag]
[/set]
to interpolate a tag.
This all is easy to me, I suppose because I understand a little bit how
UNIX works (and perhaps in small part because I wrote the program ;). Note
that most UNIX programs don't allow you to mix positional arguments and
options. This comes natural to me and I forget that it doesn't to others.
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
In character, in manners, in 131 Willow Lane, Floor 2 | || _ \
style, in all things, the Oxford, OH 45056 | || |_) |
supreme excellence is <mikeh@minivend.com> |___| _ <
simplicity. -- Longfellow 513.523.7621 FAX 7501 |_| \_\