[ic] Specify flypage using javascript or another non-database method
DB
db at m-and-d.com
Thu Jun 25 13:35:29 UTC 2015
> I got around to trying this finally. In my global directory I created
> is_mobile.tag containing:
>
> UserTag is_mobile hasEndTag
> UserTag is_mobile Routine <<EOR
> use HTTP::BrowserDetect;
> sub {
> if(! defined $Vend::Session->{mobile_browser}) {
> my $ua =
> HTTP::BrowserDetect->new($Vend::Session->{browser});
> if($ua->mobile()) {
> $Vend::Session->{mobile_browser} = 1;
> }
> else {
> $Vend::Session->{mobile_browser} = 0;
> }
> }
>
> return $Vend::Session->{mobile_browser}
> ? Vend::Interpolate::pull_if(shift (@_))
> : Vend::Interpolate::pull_else(shift (@_) );
> }
> EOR
>
>
> and then in my catalog.cfg I added:
>
> Sub change_fp <<EOR
> sub {
> return unless $Tag->is_mobile();
> $Config->{SpecialPage}->{flypage} = 'mflypage';
> return;
> }
> EOR
>
> Autoload change_fp
>
> I restarted IC and it squawked about HTTP::BrowserDetect missing, so I
> installed that using yum. But now in my catalog error log I get:
>
> CAT /cgi-bin/CAT/index.html Died in server spawn: Can't locate object
> method "mobile" via package "HTTP::BrowserDetect" at (eval 500) line 5.
>
> Maybe the version of HTTP::BrowserDetect that yum (Centos 5) installed
> is too old? Any other thoughts?
>
> DB
I think it was just too old. I was able to manually install the current
version and the warning went away. So now I can test to see if the
detection works.
DB
More information about the interchange-users
mailing list