MiniVend Akopia Services

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

Re: [mv] help with multiple defined [random] banners?



Quoting Ryan Hertz (rhertz@gyb.baits.com):
>> from Victor Nolton <ven@pragakhan.com>
> >>How would each file of the random list do this? Would it call its own
> >>[random] tag? If so, how would it be diferent from the others? I thought
> >>random couldn't be restricted to specified banners from a list either.
> 
> [if [item-category] eq "business"]
> 	<IMG SRC="businessbanner.gif">
> [/if]
> [if [item-category] eq "lordsofacid"]
> 	<IMG SRC="loa2.gif">
> [/if]
> [if [item-category] eq "pragakhan"]
> 	<IMG SRC="pragakhan.gif">
> [/if]
> 

This will definitely not work, as it is not proper syntax for
the [if ...] tag.

Is the only thing to go above 16? Whoosh, you are relieved of
that limitation. I did it quite a long time ago and forgot to change
the docs.

I did a banner tag quite a while ago which does things based
on a database and a category.

UserTag banner Order place
UserTag banner AddAttr
UserTag banner Routine <<EOF
sub {
    my ($place, $opt) = @_;
    my $totrot;
	my $db = $opt->{table}					|| 'banner';
	my $ad_field  = $opt->{ad_field}		|| 'notes_field';
	my $rot_field = $opt->{rotate_field}	|| 'rotate';
    do {
        $totrot = Vend::Interpolate::tag_data($db, $rot_field, $place);
        if(! $totrot) {
            # Do nothing, not an active ad
        }
        elsif ($totrot) {
            my $current = $Vend::Session->{scratch}->{"rotate_$place"}++ || 0;
            my $data = Vend::Interpolate::tag_data($db, $ad_field, $place);
            my(@ads) = split /\n\n/, $data;
            return '' unless @ads;
            return $ads[$current % scalar(@ads)];
        }
        else {
            return Vend::Data::database_field($db, $place, $ad_field);
        }
    } while $place =~ s/(.*):.*/$1/;
}
EOF

Basically, it allows you to set up a "banner" database that can
either rotate or place single ads. The default would work with
a catalog.cfg entry of:

Database banner banner.asc LINE
Database banner CONTINUE   NOTES

And data in banner.asc of:

--- begin banner.asc 
code
ad

code: Surrealists
rotate:   1

Freak out with Keiko!

Dali is peachy!
~
code: Renaissance
rotate:   0

Leonardo is the man.
~
code: Americana

This will never be displayed.
~
--- end banner.asc 

In the above example (which per my normal policy I will not go interactive on)

	Surrealists: [banner [item-field category]] would rotate between two messages
                 since rotate field is set to non-zero.
	Renaissance: [banner [item-field category]] would always be the same message,
                 since rotate field is set to zero.
	Americana:   [banner [item-field category]] would never be displayed,
                 since rotate field is blank.

If I were to do it today, I would probably return a pointer to a database
structure so I could keep ads in a second database based on campaign. Even
now, it wouldn't be too difficult.

Above:
<            my(@ads) = split /\n\n/, $data;
<            return '' unless @ads;
<            return $ads[$current % scalar(@ads)];
New:
>            my(@ads) = Text::ParseWords::shellwords($data);
>            return '' unless @ads;
>            return $ads[$current % scalar(@ads)];

Now [data table=ads field=ad_html key="[banner Surrealists]"]
would work if you had a space-separated list of keys to the 
ads.

-- 
Mike Heins                          http://www.minivend.com/  ___ 
                                    Internet Robotics        |_ _|____
Fast, reliable, cheap.              131 Willow Lane, Floor 2  | ||  _ \
Pick two and we'll talk.            Oxford, OH  45056         | || |_) |
 -- unknown                         <mikeh@minivend.com>     |___|  _ <
                                    513.523.7621 FAX 7501        |_| \_\


Search for: Match: Format: Sort by: