MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

interpolation question




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.

I got it to work (sort of) with this:

(creation)

[perl values interpolate=1]
$Safe{values}{private_label_name} = q{[data ...]};
[/perl]

(use)

[perl values]
$temp = $Save{values}{private_label_name};
return $temp;
[/perl]

It appears to work.  The problem is that it is interpolating this at time
of use, not time of variable creation.  If I change the use from that
above to this:

[perl values]
$temp = $Save{values}{private_label_name};
return length($temp);
[/perl]

I get 120!!  That is the length of the original [data ...] string.  So,
the string is being passed through without any interpolation at all and
them being interpolated in a [perl] block that signals _no_ interpolation.

I am very confused by this.  It certainly looks like a bug.  I tried
putting [calc] tags around various parts of this to force interpolation,
but I get only two results:

1) I get the [data ...] string itself
2) it is passed totally unchanged to the point of use and then executed.

I am trying to prevent all the database accesses for each page that are
occuring.  Right now, I get something like _10_ per page.  I do all ten on
the first page and I want to cache the results in variables.  This is
causing my pages to be horribly slow (I can see the database server logs
to see just how many queries are running).

Any help would be appreciated.

(MV 3.12, Linux 2.2.9, Red Hat 6.0, Apache 1.3.x, MySQL 3.22.x)

Best,
Kyle






Search for: Match: Format: Sort by: