Forums / Templates, Stylesheets, Page Layout / Display categories on tpl_index_default.php

Display categories on tpl_index_default.php

Locked
Results 1 to 20 of 24
This thread is locked. New replies are disabled.
17 Aug 2006, 09:59
#1
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Display categories on tpl_index_default.php

Hi,

After doing many searches I cannot find the answer to this simple (?!) problem (although plenty of people confused with this part of ZC ;)):

I want to display categories on home page and still be able to use tpl_index_default.php so that I can customize the home page.

If I enable categories on home page by using 'Layout Settings ... Categories - Always Show on Main Page', then tpl_index_default.php is not used - which means I cannot customize the home page.

I tried copying code from tpl_index_categories.php, but that didn't work. :(

Can anyone point me in the right direction?!

Thanks. :)
18 Aug 2006, 12:09
#2
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

Well, a few more hours and still haven't worked it out. :(

If no one can tell me how to do this I guess I'll just have to hardcode the HTML for the categories - which obviously isn't a great solution.

Anyone?
18 Aug 2006, 12:16
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Display categories on tpl_index_default.php

You said you want:
1. display categories on home page
2. customize the home page

What exactly do you mean by customize?
18 Aug 2006, 12:22
#4
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

The main reason for this is so I can add some custom content below the categories, so the page will look like:

[content from main_page in Define Pages Editor]
[categories list]
[New products for August]
[specials]
[custom content block added to template]


Hope that makes sense :) (I'm developing on local server so can't give URL).
18 Aug 2006, 13:24
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Display categories on tpl_index_default.php

How about extending the functionality a bit:

in both of these files:
/includes/templates/YOURTEMPLATE/templates/tpl_index_default.php
/includes/templates/YOURTEMPLATE/templates/tpl_index_categories.php

at the bottom, but above the final </div> add a line like this:
[PHP]<?php include($template->get_template_dir('tpl_my_index_content.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_my_index_content.php'); ?>[/PHP]

Then make a new file at:
includes/templates/YOURTEMPLATE/templates/tpl_my_index_content.php

and in that file put your custom HTML code.
18 Aug 2006, 13:40
#6
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

Thanks for the tip - I'll try it out :) ......

..... but that doesn't solve my problem (unless I'm missing the point - always possible!).

I only want [custom content] on the home page which means I need to add it to tpl_index_default.php. If I add it to tpl_index_categories.php [custom content] will show on category listings (although I discovered only on categories that have sub-categories for some reason).

So what I'm asking is - how do I include the code to display categories in tpl_index_default.php?

Thanks for your patience. :))
18 Aug 2006, 15:23
#7
goshawk avatar

goshawk

Zen Follower

Join Date:
Aug 2006
Posts:
220
Plugin Contributions:
2

Re: Display categories on tpl_index_default.php

I also have similar problems in customising my pages, as you can see on my shop front, I still have a lot to do, as I want to display only the left column, and get rid of the one on the right. I also want to display a custom background in each of the columns, so the page looks like one, and not like it is displaying different frames.

Would I need to make my own css template to set the backgrounds?

I am new to php, and find it very chalenging, but I need this webpage to display fully customised, as it will serve as our image for a long time.

Here is my (terrible looking:dontgetit ) shop under construction:

http://www.inekesfashions.com.au/shop/

Thank you very much for your response,

Goshawk
18 Aug 2006, 15:54
#8
milkyway avatar

milkyway

Inactive

Join Date:
Aug 2006
Posts:
167
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

You can 'turn-off' right column from admin -> layout settings -> column right status - global -> 0 (off)

You can set custom column background from CSS file. it depend on which backround you need to fill, example for the entire left column you need to modify .columnLeft from the CSS files.

It is recommended that you make a custom override template/css folder and tweak all css entires you need from there, so you dont mess up with the core code and prevent trouble for future upgrading. Please check the related thread about this issue.

Those above steps didn't require any php code knowledge.
18 Aug 2006, 16:07
#9
goshawk avatar

goshawk

Zen Follower

Join Date:
Aug 2006
Posts:
220
Plugin Contributions:
2

Re: Display categories on tpl_index_default.php

Thanks milky way:smile:
20 Aug 2006, 15:05
#10
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

bump. :(

.......................
21 Aug 2006, 05:22
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Display categories on tpl_index_default.php

Turn off all Center Boxes ...

Turn off Always Show Categories on Main page ...

Turn off Define Page for Main Page ...

Have you an URL to see what you have done so far?
21 Aug 2006, 10:20
#12
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

No URL - it's all on localhost. I'll re-phrase my question:

how do I include top level category listing within tpl_index_default.php? That's all! :)

I tried taking the following code from tpl_index_categories.php, but it did not work:

<?php
$show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_CATEGORY);

while (!$show_display_category->EOF) {
  // //  echo 'I found ' . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS);

?>
21 Aug 2006, 17:34
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Display categories on tpl_index_default.php

Turn on the Always Show and set the Category to 0 in Layout Settings ...
Categories - Always Show on Main Page
Always Show Categories on Main Page
0= off
1= on
Default category can be set to Top Level or a Specific Top Level


Main Page - Opens with Category
0= Top Level Categories
Or enter the Category ID#
Note: Sub Categories can also be used Example: 3_10
21 Aug 2006, 19:55
#14
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

Thank you for the time and reply, Linda - but that doesn't answer my question .......

....... as I already described in original post, if I 'always show categories on home' page, tpl_index_default.php is not used (tpl_index_categories.php is used) and then I cannot customize the home page as I need to.

Is it possible to include top level category listing within tpl_index_default.php? :)
22 Aug 2006, 03:27
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Posts:
62,757
Plugin Contributions:
1

Re: Display categories on tpl_index_default.php

If you look at:
tpl_index_categories.php

You will see the section of code for where the $show_welcome is set to true ... that section displays the main page info ... then afterwards the remainder of the code runs the categories ...

You can customize this in your templates and overrides to display what you want to see ...
22 Aug 2006, 08:09
#16
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

..... but if I customize tpl_index_categories.php it also displays on category pages - I don't want that - I just want a block of custom content added to the bottom of the home page.

That's why I keep asking how to add categories to tpl_index_default.php. ;) I'm guessing the reason you don't answer that question is because it's not possible???
22 Aug 2006, 11:01
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Display categories on tpl_index_default.php

purkat:

The main reason for this is so I can add some custom content below the categories, so the page will look like:

[content from main_page in Define Pages Editor]
[categories list]
[New products for August]
[specials]
[custom content block added to template]

Hope that makes sense :) (I'm developing on local server so can't give URL).

purkat:

I only want [custom content] on the home page which means I need to add it to tpl_index_default.php. If I add it to tpl_index_categories.php [custom content] will show on category listings (although I discovered only on categories that have sub-categories for some reason).

So what I'm asking is - how do I include the code to display categories in tpl_index_default.php?

Some things are still not fully clear.

1. Zen Cart can be configured to show categories on the home page, or not.
2. If you choose to display categories on the home page, then tpl_index_default.php is ignored

The answers being given have been in keeping with the way Zen Cart works.

However, what you haven't stated clearly is whether you "require" that your home page "have" your categories shown on it (which is not the default, but is what Ajeh was mentioning at one point).

If you "must" have your categories listing show on the home page, then you need to enable the indicated switch.

Then if you must add custom content "only" when no category is selected, then you'll need to edit as follows:
/includes/templates/YOURTEMPLATE/templates/tpl_index_categories.php
at bottom of file, add:[PHP]<?php // display my custom content only on home page:
if (!($current_page!='index' || (int)$cPath>0 )) { ?>
<div><h2>My Custom Content Goes Here</h2></div>
<?php } ?>[/PHP]
22 Aug 2006, 12:45
#18
purkat avatar

purkat

New Zenner

Join Date:
Mar 2006
Posts:
21
Plugin Contributions:
0

Re: Display categories on tpl_index_default.php

That's it!! Thanks very much for sticking with it DrByte. :)) And thanks Ajeh for your help.

I've told my boss to add some more to the donation that was on its way once this site gets finished. :)
22 Aug 2006, 13:27
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Display categories on tpl_index_default.php

:wink2: Sometimes it just takes a bit of careful re-explaining and/or re-studying the requirements in order to get to the answer !
23 Aug 2006, 12:00
#20
goshawk avatar

goshawk

Zen Follower

Join Date:
Aug 2006
Posts:
220
Plugin Contributions:
2

Re: Display categories on tpl_index_default.php

milkyway:

You can 'turn-off' right column from admin -> layout settings -> column right status - global -> 0 (off)

You can set custom column background from CSS file. it depend on which backround you need to fill, example for the entire left column you need to modify .columnLeft from the CSS files.

It is recommended that you make a custom override template/css folder and tweak all css entires you need from there, so you dont mess up with the core code and prevent trouble for future upgrading. Please check the related thread about this issue.

Those above steps didn't require any php code knowledge.



Hi Milkyway,

Unfortunately this approach does not seem to work.:down:
I am making chances in another folder from the default_template, and using stylesheet.css 3688 2006-06-02 00:12:18Z drbyte $

If you look at my site http://www.inekesfashions.com.au/shop/
you will notice that in IE you can just see a glimpse of my graphic in the header, but this does not display at all in FF or in Opera.

I would like to place a graphic, both in the white spaces of the boxed text, and in the headings. (these graphics will than join, to make it look like 1 box, and will adjust to the size, as the bottom graphic is longer than the white space)

I also would like you to have a look at my flash logo, as it does not display in Opera (but I am not sure if the flash plugin installed ok in opera).

I am almost done with my artistry :unsure: before I can go and install some product, and connect to a payment gateway.

Kind regards for your earlier response,

Goshawk