Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Embedding Flash/XML using a div

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-26-2009, 11:05 AM
 
Audentio Audentio is offline
 

Newbie
  
Join Date: Sep 2009
Posts: 6
 

Default Embedding Flash/XML using a div

Hey there, I am having some trouble embedding this flash document found here: http://p-treasures.com/banner on to the index page (http://p-treasures.com/) in that black box. When I designed the static html/css template, it worked fine. When I put the same code into X-Cart, it won't work! I don't understand, but I thought it *might* have something to do with smarty.class.php stopping embedding of xml/swf into divs.

Any help would be very much appreciated, and I will donate to the person who helps me.
__________________
X-Cart Pro 4.2.2
Reply With Quote
  #2  
Old 09-26-2009, 10:32 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Embedding Flash/XML using a div

The javascript code on your index page looks different than the code on the other link you posted.

Are you using {literal}{/literal} in your template so smarty will not try and compile the javascript? See this

Also - you have this commented out - is that intended?:
// flashvars.settingsXML = "../banner/settings.xml";
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote

The following user thanks gb2world for this useful post:
Audentio (09-27-2009)
  #3  
Old 09-27-2009, 09:26 AM
 
Audentio Audentio is offline
 

Newbie
  
Join Date: Sep 2009
Posts: 6
 

Default Re: Embedding Flash/XML using a div

Hey thanks for your reply. I am editing custom/service_head.tpl and this is the code:
Code:
{* $Id: service_head.tpl,v 1.8 2008/12/05 12:54:17 joy Exp $ vim: set ts=2 sw=2 sts=2 et: *} <title>{$html_page_title|escape}</title> {include file="customer/meta.tpl"} {include file="customer/service_css.tpl"} {if $config.SEO.clean_urls_enabled eq "Y"} <base href="{$catalogs.customer}/" /> <script src="{$SkinDir}/anchor_fix.js" type="text/javascript"></script> {/if} {literal} <script type="text/javascript" src="../banner/swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; flashvars.settingsXML = "../banner/settings.xml"; var params = {}; params.scale = "noscale"; params.salign = "tl"; params.wmode = "transparent"; var attributes = {}; swfobject.embedSWF("../banner/banner.swf", "flashbanner", "792", "142", "9.0.0", false, flashvars, params, attributes); </script> {/literal}
swfobject.embedSWF takes the following parameters: file, div class name (requires <div class="flashbanner"></div> somewhere), width, height, etc. In customer/home.tpl I have the flashbanner class. It works on a regular html file, however I can't get it to work with home.tpl. I did what you said and I wrapped the literal tags around my javascript in the service_head.tpl template which fixed it changing my javascript (I think, I hadn't noticed it in the first place). But it still won't put the swf into the div. The directories work just fine, I don't understand.
__________________
X-Cart Pro 4.2.2
Reply With Quote
  #4  
Old 09-27-2009, 11:06 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Embedding Flash/XML using a div

Assuming all your variables/parameters are set up correctly, that leaves your paths to the files.

I am not sure why you need the "../" in the paths - you have XCART installed at the top of your directory structure - not a sub-directory, correct? Then XCART is running at the top of your directory structure.

Also - depending upon how the script/flash you are using is written - the path defined for your xml file may not be relative to home.php? The information for how to set the path should be in the script/flash or any documentation provided.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #5  
Old 09-27-2009, 11:50 AM
 
Audentio Audentio is offline
 

Newbie
  
Join Date: Sep 2009
Posts: 6
 

Default Re: Embedding Flash/XML using a div

It says to add this line:
Code:
flashvars.folderPath = "PATH";
Where do I put the path to? Would it be skin1/customer/?

Just to clarify, this is where ALL the flash files are (xml, images, swf file, the js files required by the flash script) in www/banner/. X-Cart is on the root. The code as it stands now based off of what you said is this:

Code:
{literal} <script type="text/javascript" src="banner/swfobject.js"></script> <script type="text/javascript"> var flashvars = {}; flashvars.folderPath = "skin1/customer/"; flashvars.settingsXML = "banner/settings.xml"; var params = {}; params.scale = "noscale"; params.salign = "tl"; params.wmode = "transparent"; var attributes = {}; swfobject.embedSWF("banner/banner.swf", "flashbanner", "792", "142", "9.0.0", false, flashvars, params, attributes); </script> {/literal}
in skin1/customer/service_head.tpl. I didn't include the whole template, just the code I need obviously. It still won't work, I have no idea why. How do I make it relative to skin1/customer/home.tpl? Thanks for all your help so much mate, I'm very appreciative. Please help me get this to work and Ill give you a token of my appreciation.
__________________
X-Cart Pro 4.2.2
Reply With Quote
  #6  
Old 09-27-2009, 12:06 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Embedding Flash/XML using a div

Not skin1 - it is true the templates are in skin1 - but what is executing (home.php, etc.) is at your top level.

Without going over the documentation about what exactly the parameters of your script are - I suspect this:
flashvars.folderPath = "banner"
flashvars.settingsXML = "banner/settings.xml"

It that does not work - I would go back to what you were originally trying to do - get it to work outside of XCART first. But this time - put your experimental file at your top level directory. Once you get it to work there - do the same thing in XCART. I don't think there is anything in XCART that will prevent it from working.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #7  
Old 09-27-2009, 12:27 PM
 
Audentio Audentio is offline
 

Newbie
  
Join Date: Sep 2009
Posts: 6
 

Default Re: Embedding Flash/XML using a div

I added that but man, it still won't work. It works fine at http://p-treasures.com/banner/ and that is at the root directory (obviously from the url). It has to be something x-cart is doing. Even if the xml was wrong, the SWF should still show up! It would just not work correctly. As long as I can get the swf to show up, I think I can figure out the rest. I just don't understand.
__________________
X-Cart Pro 4.2.2
Reply With Quote
  #8  
Old 09-27-2009, 12:47 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Embedding Flash/XML using a div

Debug your file in your top level directory - http://p-treasures.com - not in the banner subdirectory. XCART runs in your top level directory. If you get it to run at your top level outside of XCART - then you know you have your parameters/paths set correctly.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
  #9  
Old 09-27-2009, 12:50 PM
 
Audentio Audentio is offline
 

Newbie
  
Join Date: Sep 2009
Posts: 6
 

Default Re: Embedding Flash/XML using a div

So I need to create a file like banner.php and run the js and html to make it work on p-treasures.com/banner.php? I can keep all the script files in www/banner/ right? Just the js and the html div should be on the top level, correct?
__________________
X-Cart Pro 4.2.2
Reply With Quote
  #10  
Old 09-27-2009, 01:11 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Embedding Flash/XML using a div

Yes - I think that is the best way. Once you get the file at http://p-treasures.com/banner.php to work - then you know you have the parameters & paths set up correctly. Then - drop that code into the XCART templates - which you have already figured out.

Your other option - which would be messier - is to get rid of the banner subdirectory and move all the code inside to the top level.

You might look for guidance in the documentation for the script/flash, or , if they gave you the flash source, you can see in the actionscript how they are referencing the xml file. Usually - they will try and give you information about properly setting up paths to the xml. This all has to be set up correctly for such scripts/flash to work properly. The flash has to be able to find the xml file.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:55 AM.

   

 
X-Cart forums © 2001-2020