![]() |
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:
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:
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 |
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} > Regards Shafiq :sK |
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 |
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} > Quote:
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 |
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 !! |
All times are GMT -8. The time now is 02:19 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.