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)
-   -   Discriminating Against Static Pages (https://forum.x-cart.com/showthread.php?t=36372)

anela2003 12-26-2007 09:23 PM

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. :oops:

anela2003 12-26-2007 09:31 PM

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.

Jon 12-26-2007 10:43 PM

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.

anela2003 12-26-2007 11:14 PM

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.

Jon 12-27-2007 08:36 AM

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);
}



All times are GMT -8. The time now is 11:15 AM.

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