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

Discriminating Against Static Pages

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-26-2007, 09:23 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Default Discriminating Against Static Pages

I have a quick question.

I have created two different templates. One designs my embedded static pages and another designs my root level static pages. The difference is that one has a left-side menu and the other one doesn't.

How do I create a code (and where do I place it) that says something like:

--------
If this is an embedded page, use customer/home1.tpl. If this is a root level page, use customer/home.tpl.
------

As always, I appreciate it.
__________________
4.1.9 Gold

window valances | curtains
Reply With Quote
  #2  
Old 12-26-2007, 09:31 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Default Re: Discriminating Against Static Pages

Let me rephrase that. I just realized that my root level pages don't contain any of my home.tpl design but it's just the HTML entirely.

Out of my embedded pages only, how do I tell for each page individually to call either the home.tpl or home1.tpl design?

I'm guessing that I will have to redesign each page individually with its own template, but I hope there's an easier way around it.
__________________
4.1.9 Gold

window valances | curtains
Reply With Quote
  #3  
Old 12-26-2007, 10:43 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Discriminating Against Static Pages

Open pages.php

FIND:

func_display("customer/home.tpl",$smarty);

REPLACE WITH SOMETHING SUCH AS:

if ($pageid == "X") {
func_display("customer/home1.tpl",$smarty);
} elseif ($pageid == "X") {
func_display("customer/home2.tpl",$smarty);
} else {
func_display("customer/home.tpl",$smarty);
}

Replace "X" with the numeric pageid.
Reply With Quote
  #4  
Old 12-26-2007, 11:14 PM
 
anela2003 anela2003 is offline
 

Senior Member
  
Join Date: Nov 2007
Posts: 103
 

Default Re: Discriminating Against Static Pages

That code works beautifully but the trouble is that I have several pages and the script works only for one page at a time. What if I wanted a list with something like

if ($pageid == "190", "191", "195", "203") {

?

How can that be done without parse errors? I tried looking in the the Smarty manual for examples but it seems like commas and quotation marks is what's being used so I'm a bit confused. Thanks.
__________________
4.1.9 Gold

window valances | curtains
Reply With Quote
  #5  
Old 12-27-2007, 08:36 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Discriminating Against Static Pages

Code:
if ($pageid == "190" OR $pageid == "191" OR $pageid == "195" OR $pageid == "203") { func_display("customer/home1.tpl",$smarty); } elseif ($pageid == "X") { func_display("customer/home2.tpl",$smarty); } else { func_display("customer/home.tpl",$smarty); }
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 07:45 AM.

   

 
X-Cart forums © 2001-2020