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

Is this correct coding?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-30-2007, 11:44 AM
  SystemSkins's Avatar 
SystemSkins SystemSkins is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 350
 

Default Is this correct coding?

I'm trying to get a feel for smarty coding. Please take a look at this and tell me if this is correct coding?

The original code is from the rectangle_top.tpl

Quote:
{* $Id: rectangle_top.tpl,v 1.25 2006/02/07 08:09:51 max Exp $ *}
<table class="Container" cellpadding="0" cellspacing="0" width="{$width|default:"100%"}">
<tr><td class="Container">

It is to my understanding that this is the file where you can change the width of both your "customer" and "admin" x-cart.

I want my cart/website to be optimized for the 1024 x 768 resolution. Thus I am trying to set my cart with to 970px.

I personally use a 23" Widescreen and prefer to keep my admin area at 100%

With ZERO knowledge of smarty I have figured out (by reading on these forums) how to do what I want.

Here is my new code:

Quote:
{* $Id: rectangle_top.tpl,v 1.25 2006/02/07 08:09:51 max Exp $ *}
{if $usertype eq "C"}
<table class="Container" cellpadding="0" cellspacing="0" width="{$width|default:"970px"}" align="center">
<tr><td class="Container">
{else}
<table class="Container" cellpadding="0" cellspacing="0" width="{$width|default:"100%"}">
<tr><td class="Container">{/if}

This coding does what I want it to do, it makes the customer area optimized for 1024x768 and leaves admin area alone.

My question is: Did I do it the right way? or do I have too much info? or is there a better way it should read?


Thanks
__________________
Doug Rock
X-cart Gold 4.1.9
_____________________________________
Altered Cart: 1-Page checkout
Firetank: Feed Manager
Website CM: CDSEO PRO
Website CM: Product A-Z Map
Website CM: Review Approval
Website CM: Site Map Pro
Qualiteam: Sales & Stats (free version)
Reply With Quote
  #2  
Old 10-30-2007, 12:26 PM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,471
 

Default Re: Is this correct coding?

That looks ok .. i guess you can do the above with less amount of code:

Code:
<table class="Container" cellpadding="0" cellspacing="0" {if $usertype eq "C"} width="{$width|default:"970px"}" align="center" {else} width="{$width|default:"100%"}" {/if} > <tr> <td class="Container">

Regards

Shafiq :sK
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #3  
Old 10-30-2007, 12:29 PM
  SystemSkins's Avatar 
SystemSkins SystemSkins is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 350
 

Default Re: Is this correct coding?

YEAH ! thats what I'm looking for. I didn't know if there was a less coding type way of doing it.

But will that way of writing it center the Admin area too? or just the customer? er... does everything you see before the {else} tag pertain to the {if $usertype eq"C"} tag and everything after the {else} tag remain default?

Like I said, my first time playing with smarty coding so i'm not familiar with how it works. Wasn't sure if you can put it inside the <table> tags or not, I thought it had to be on the outside.

Thanks
__________________
Doug Rock
X-cart Gold 4.1.9
_____________________________________
Altered Cart: 1-Page checkout
Firetank: Feed Manager
Website CM: CDSEO PRO
Website CM: Product A-Z Map
Website CM: Review Approval
Website CM: Site Map Pro
Qualiteam: Sales & Stats (free version)
Reply With Quote
  #4  
Old 10-30-2007, 01:47 PM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: Is this correct coding?

Doug,

You are going to LOVE Samrty!

One thing -- if you do an if/else for $usertype eq "C" -- thee are also possible usertypes that are not admin, such as "partner" if you use the x-affiliate module. So, sometimes if you want something FOR the admin only, it's best to code FOR $usertype eq "A" and not for the "C" --

Code:
<table class="Container" cellpadding="0" cellspacing="0" {if $usertype eq "A"} width="{$width|default:"100%"}" {else} width="{$width|default:"970px"}" align="center"{/if} > <tr> <td class="Container">

Quote:
But will that way of writing it center the Admin area too?

No - if you want to center the admin too, then move the closing {/if} BEFORE the align="center"

You'll get it... just keep trying stuff and Smarty will make it clear what works and what doesn't.

Have fun!

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #5  
Old 10-30-2007, 05:50 PM
  SystemSkins's Avatar 
SystemSkins SystemSkins is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 350
 

Default Re: Is this correct coding?

Ahhh, good point Jeremy. Yeah I got my work cut out for me. I'm having a hell of a time trying to figure out customizing my header atm.

Thanks !!
__________________
Doug Rock
X-cart Gold 4.1.9
_____________________________________
Altered Cart: 1-Page checkout
Firetank: Feed Manager
Website CM: CDSEO PRO
Website CM: Product A-Z Map
Website CM: Review Approval
Website CM: Site Map Pro
Qualiteam: Sales & Stats (free version)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 02:33 AM.

   

 
X-Cart forums © 2001-2020