X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Embedding Flash/XML using a div (https://forum.x-cart.com/showthread.php?t=49895)

Audentio 09-26-2009 11:05 AM

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.

gb2world 09-26-2009 10:32 PM

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";

Audentio 09-27-2009 09:26 AM

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.

gb2world 09-27-2009 11:06 AM

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.

Audentio 09-27-2009 11:50 AM

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.

gb2world 09-27-2009 12:06 PM

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.

Audentio 09-27-2009 12:27 PM

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.

gb2world 09-27-2009 12:47 PM

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.

Audentio 09-27-2009 12:50 PM

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?

gb2world 09-27-2009 01:11 PM

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.


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

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.