Forums / Templates, Stylesheets, Page Layout / customising main page while not effecting other pages

customising main page while not effecting other pages

Locked

Views: 2,488

Results 1 to 13 of 13
This thread is locked. New replies are disabled.
11 Jan 2007, 11:18 AM
#1
arpeggio avatar

arpeggio

Zen Follower

Join Date:
Dec 2006
Location:
Tokyo, Melbourne, Shanghai
Posts:
102
Plugin Contributions:
0

customising main page while not effecting other pages

Yesterday I removed the sideboxes from just the main page but could leave them on all other pages. This was a major breakthru for me!!
It is easily done by assigning a flag for either: left, right, header, footer.

but

Now I want to remove only a small portion of the header itself like: the Navigation Breadcrumb, and Categories Bar.

I used "<!-- blah blah --> to make the Bar not appear but now i cannot see it on any pages!! :no:
Is there another level to which i can use the override system for just the header of the Main Page but leave all other headers unchanged??

I also want to remove the centerBoxContent and heading on the main page but want it on all other pages. can this also be done?

Any help most appreciated.

11 Jan 2007, 1:00 PM
#2
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: customising main page while not effecting other pages

If you are using a recent version of Zen Cart you can wrap the code you don't want to be executed on the home page with the following> if (!$this_is_home_page ) {

<code to be not executed>

}

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

13 Jan 2007, 2:34 AM
#3
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: customising main page while not effecting other pages

Now I want to remove only a small portion of the header itself like: the Navigation Breadcrumb

If you're using version 1.3.7 you can control the breadcrumb in admin -> configuration -> layout settings: you can turn them off completely turn them on for all pages or turn them off on just the main page.

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

15 Jan 2007, 10:58 AM
#4
outlawlb avatar

outlawlb

New Zenner

Join Date:
Jan 2007
Posts:
86
Plugin Contributions:
0

Re: customising main page while not effecting other pages

I know how n00b this sounds but which files would be the files to work on if I had to do any hand coding for the main page?

15 Jan 2007, 11:22 AM
#5
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: customising main page while not effecting other pages

That would depend. The structure of the main page is controlled by common/tpl_main_page.php, but it pulls in content from the entire template system. Could you provide more information about what you'd like to do.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

15 Jan 2007, 8:00 PM
#6
outlawlb avatar

outlawlb

New Zenner

Join Date:
Jan 2007
Posts:
86
Plugin Contributions:
0

Re: customising main page while not effecting other pages

Basically I would have several images and one log in box.

What I am doing will make this main page look like a brochure cover.

16 Jan 2007, 12:11 AM
#7
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: customising main page while not effecting other pages

In which case your best bet is probably to use the $this_is_home_page variable in the tpl_main_page template with a statement such as

if ($this_is_home_page) {
  require(custom_landing_page.php);
} else {
  require($body_code);
}

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

16 Jan 2007, 2:02 PM
#8
outlawlb avatar

outlawlb

New Zenner

Join Date:
Jan 2007
Posts:
86
Plugin Contributions:
0

Re: customising main page while not effecting other pages

I found it in the common for template I also have this page though: tpl_index_default.php

Do I need to edit that as well?

Also I can just code the "custom_landing_page" with anything and have such things as the categories on the side?

16 Jan 2007, 2:12 PM
#9
outlawlb avatar

outlawlb

New Zenner

Join Date:
Jan 2007
Posts:
86
Plugin Contributions:
0

Re: customising main page while not effecting other pages

And where do I place the custom landing page? Anywhere I need to?

16 Jan 2007, 2:39 PM
#10
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: customising main page while not effecting other pages

One of the joys of Zen Cart is that there are often many ways of achieving the same thing, especially when you get into coding. Of course, that can also be confusing.

The best way of implementing your changes will depend on how much change you want to make to the front page. If it's just some changes to the center column below the bradcrumbs then editing the tpl_index_default.php file may be the best approach. If it's largely the same structure, but has different content on the home page, you may wish to insert the different code directly into an IF statement such as that above, in the place that you want the alternative content to appear in the tpl_main_page.php file (a look at the large comment in the header of this file explains many more localiszed changes you could make such as selectively turning sideboxes on and off). If the page will look radically different, you might wish to simply call a completely different page. There's no right answer, it depends on the design.

One thing to absolutely master however, is the override system. Hopefully you're already on this. If not a quick visit to the FAQ and the Wiki will save a lot of heartache later.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

22 Jan 2007, 3:14 PM
#11
gregoryjameswood avatar

gregoryjameswood

New Zenner

Join Date:
Jan 2007
Posts:
30
Plugin Contributions:
0

Re: customising main page while not effecting other pages

kuroi:

if ($this_is_home_page) {
require(custom_landing_page.php);
} else {
require($body_code);
}


can i replace $body_code with a php document? then follow with $body_code?

also, could anyone tell me what php tags to wrap this up in.

Thanks
22 Jan 2007, 3:23 PM
#12
kuroi avatar

kuroi

Totally Zenned

Join Date:
Apr 2006
Location:
London, UK
Posts:
10,475
Plugin Contributions:
11

Re: customising main page while not effecting other pages

$body_code is basically a BIG string of XHTML that will make up everything that goes into your center panel. So I wouldn't advise touching it unless you know what you're doing.

However, if what you're asking is how can I insert my own php content in the center panel before it, you could either simply place it before the line where you include (require) the $body_code, or better still include your php file immediately before the require statement.

You shouldn't need additional php tags as the require statement will already be inside them.

Kuroi Web Design and Development | Twitter

(Questions answered in the forum only - so that any forum member can benefit - not by personal message)

22 Jan 2007, 4:42 PM
#13
gregoryjameswood avatar

gregoryjameswood

New Zenner

Join Date:
Jan 2007
Posts:
30
Plugin Contributions:
0

Re: customising main page while not effecting other pages

Cheers mate,

what I meant was could I do this

<?php 
    if ($this_is_home_page) {
      require($template->get_template_dir('products.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/products.php');
    } else {
      require($template->get_template_dir('content_bar.php',DIR_WS_TEMPLATE, $current_page_base,'common'). '/content_bar.php');
    }  
    ?>

and then include the $body_code at a later stage. I've sorted it though, but ta for your help, my php manipulation is presently as advanced as wordpress includes :)