PDA

View Full Version : include file depending on category


zoddzodd
09-24-2006, 10:30 AM
Hi,

I would like to include a file in the index, depending on the category.

How can I do that ?


for the moment i include a.html (soo, this will be showed on every pages)

and I would like to change it to :

ROOT -> include(a.html)
Cat1 -> include(Cat1.html)
Cat2 -> include(Cat2.html)
...

Any ideas would be really appreciated !

thanks,

John Turner
09-25-2006, 08:44 AM
Hi zoddzodd

There are 2 solutions

First:

You can make your category unique, that you can do in AdminPanel
You can copy index.tpl file and rename it to index[id_category].tpl,
then you can make chenges with it, for example, add source code of a.html or another file


Second:

In your index.php file after

$templ = $category['unique_tpl'] ? $category['id'] : '';

you need to insert

$gDirSmarty->assign('id_cat', $category['id']);

then
in your index.tpl file after

{if $category.description}
<div class="box" style="border: none;">{$category.description}</div>
{/if}

you need to insert

{if $category.id = 0}
{include file="a.html"}
{/if}

{if $category.id > 0}
{include file="Cat$id_cat.html"}
{/if}

where you want to include it on your page