PDA

View Full Version : How to make the category layout stretchy + index fixed


dutchbb
06-21-2006, 11:08 AM
Hi,

I would like to have the homepage fixed (600px) width, but the category and link pages stretchy (100%). Basically a separate CSS file for the home page.

Any help is greatly appreciated.

Thanks in front

Nick Collins
06-22-2006, 04:58 AM
Here is a solution for you:
1) copy your "style.css" file and rename this copy to "index.css"
2) open "index.css" and find the following code:
div.page
{
margin: 0 auto;
width: 770px;
} change width to 600px and save changes.
3) open "style.css" and change width to "100%"
4) open "header.tpl" and find the following code:
<link rel="stylesheet" type="text/css" href="{$templates}/css/style.css" /> replace it with:
{if $category.id eq '0' && $tab neq 'suggest-category' && $tab neq 'suggest-link'}
<link rel="stylesheet" type="text/css" href="{$templates}/css/index.css" />
{else}
<link rel="stylesheet" type="text/css" href="{$templates}/css/style.css" />
{/if} Save changes. That's all! Let me know in case I missed something.

dutchbb
06-22-2006, 10:00 AM
Works like a charm, thank you sir!

Nick Collins
06-23-2006, 04:25 AM
You are welcome!

Greg
06-25-2006, 12:23 AM
That's cool Nick :good:

Now if we wanted a certain category to use a different css would we replace
{if $category.id eq '0' && $tab neq 'suggest-category' && $tab neq 'suggest-link'}

With a different category id such as
{if $category.id eq '22' && $tab neq 'suggest-category' && $tab neq 'suggest-link'}

Thanks

Nick Collins
06-26-2006, 04:08 AM
Sure Greg, we can easy use different css files for different categories...

Chrisjara
07-20-2006, 03:16 PM
This post addresses some of my questions so I decided to ask here instead. If I want to make category specific templates, could I have the script use a completely different header/footer file.

Say by default that the script uses header.tpl. The category, say Cars, has a specific header - header-cars.tpl. Could the logic you wrote for category specific css also be used to call different header and footer files?

Chrisjara
07-21-2006, 03:42 AM
I have it so that my top links, popular, suggest, etc all use a different footer file.


Do you have an example of what you changed in the script to have those pages change footer files?

Dave Baker
07-21-2006, 05:05 AM
Hello Chrisjara,

You can create dependence of loading header.tlp according to a category in index.tpl file.

For this purpose in index.tpl file change the line {include file = "header.tpl"} on similar conditions:


{if $category.title eq 'Test1'}
{include file="header_test1.tpl"}
{elseif $category.title eq 'Test2'}
{include file="header_test2.tpl"}
{elseif $category.title eq 'Test3'}
{include file="header_test3.tpl"}
{else}
{include file="header.tpl"}
{/if}

At loading for category Test1 the file header_test1.tpl will be used.
For Test2 - header_test2.tpl
.....

sdawkins
07-21-2006, 11:32 AM
Chrisjara --- sure

http://www.topsportsdirectory.com/ this page uses footer.tpl

this page uses footer1.tpl http://www.topsportsdirectory.com/new-links.html

All I did was open new-links.tpl and change the include file=
footer.tpl to include file=footer1.tpl