View Single Post
  #1  
Old 05-13-2008, 01:47 AM
 
jbcarey jbcarey is offline
 

Member
  
Join Date: Apr 2008
Posts: 17
 

Default StyleSwitch "mod" - running into some issues.

hello,

I've been working on this Xcart for two weeks and I've managed to write a complete custom theme...

But now my client wishes to have a different stylesheet depending on which "categorie" the client is in... (so home.cat + sub.cat)... I'd like someone to follow my "train of Thought" and possibly tell me where I'm going wrong....


1st. I've created styleswitch.php in "xcart_dir/modules/styleswitch/"...

this is what is contains

PHP Code:
if ( !defined('XCART_SESSION_START') ) { header("Location: ../"); die("Access denied"); }
                    
                    
$sql func_query("SELECT DISTINCT parentid FROM xcart_categories WHERE categoryid='{$cat}' LIMIT 1");
                    
print_r($sql);
                    
$resmysql_query($sql) or die(mysql_error());
                    
                    echo 
$sqlprint_r($row);
                    while(
$row=mysql_fetch_assoc($res)) )
                    {
                    switch (
$row["parentid"]) {
                    case 
"15":
                    
$StyleSwitch'<style type="text/css">body {background-image: url(images/lolalayout/bg-15.gif);}
                                            .background { background-image: url(images/lolalayout/15.gif);}</style>'
;
                                            
$smarty->assign("StyleSwitch"$StyleSwitch);
                                            break;
                    
                    case 
"5":
                    
$StyleSwitch'<style type="text/css">body {background-image: url(images/lolalayout/bg-5.gif);}
                                            .background { background: #000000;}</style>'
;
                                            
$smarty->assign("StyleSwitch"$StyleSwitch);
                                            break;
                    }
                    }
                    
?> 

then I created StyleSwitch.tpl in "xcart_dir/skin1/modules/styleswitch/"...

Code:
{* $Id: StyleSwitch.tpl,v 1.8.2.1 2006/11/16 13:12:29 max Exp $ *} {if $StyleSwitch} {include file="{$xcart_dir}/modules/StyleSwitch/styleswitch.php"} {/if}


finally in "home.tpl" i call up the "files".... I suppose.

Code:
{include file="{$SkinDir}/modules/StyleSwitch/StyleSwitch.tpl" }



also i "home.php" i put

Code:
if ($active_modules["StyleSwitch"]) include $xcart_dir."/modules/StyleSwitch/styleswitch.php";

but nothing seems to be working.... could a php/smarty/xcart pro have a look at this for me please????
__________________
x-cart version: 4.1.9
Reply With Quote