View Single Post
  #4  
Old 03-25-2009, 07:09 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Open a Shadowbox upon entering a page - with a smarty IF

I had shadowbox working fine, with the following:

1. in skin1/customer/home.tpl - immediately after <head>

{* SHADOWBOX INCLUDE *}
{include file="shadowbox_include.tpl" }
{* END-SHADOWBOX INCLUDE *}

2. Contents of shadowbox_include.tpl:

Code:
{literal} <script type="text/javascript" src="/shadowbox/adapter/shadowbox-base.js"></script> <script type="text/javascript" src="/shadowbox/shadowbox-2.js"></script> <script type="text/javascript"> Shadowbox.loadSkin('classic', '/shadowbox/skin'); Shadowbox.loadLanguage('en', '/shadowbox/lang/shadowbox-en.js'); Shadowbox.loadPlayer(['flv'], ['img'], ['html'], ['iframe'], '/shadowbox/player'); window.onload = function(){ Shadowbox.init(); }; </script> {/literal}

THIS WORKS FINE. Shadowbox loads as expected, if called from an <a rel=shadwobox> tag.

So, I thought, why not make an if and look for a smarty variable? The var works as expected... but shadowbox does not seem to like being called like this...

In /customer/home.tpl, immediately after <head>

Code:
{* SHADOWBOX INCLUDE *} {if $smarty.get.reviewed eq "yes"} {include file="shadowbox_include-review-confirm.tpl" } {else} {include file="shadowbox_include.tpl" } {/if} {* END-SHADOWBOX INCLUDE *}

then shadowbox_include-review-confirm.tpl looks like:

Code:
{literal} <script type="text/javascript" src="/shadowbox/adapter/shadowbox-base.js"></script> <script type="text/javascript" src="/shadowbox/shadowbox-2.js"></script> <script type="text/javascript"> Shadowbox.loadSkin('classic', '/shadowbox/skin'); Shadowbox.loadLanguage('en', '/shadowbox/lang/shadowbox-en.js'); Shadowbox.loadPlayer(['flv'], ['img'], ['html'], ['iframe'], '/shadowbox/player'); window.onload = function(){ Shadowbox.init(); Shadowbox.open({ player: 'html', title: 'Hello World!', content: '<div style="border: 2px solid #FF07CE; width: 188; height: 188; padding: 4px; background-color: #FBDFFF; "><p>Hello World!</p></div>', height: 200, width: 200 }); }; </script> {/literal}

Does not do anything.

The code works on its own, but not when called in xcart.

What am I missing. Anyone care to try this?
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote