View Full Version : Help with categories in custom template
sdawkins
08-06-2006, 09:54 PM
I've been working on a new template / site.
I am using the modification to show the categories in the left menu (except on the main page.)
My problem is this, and no matter what I have tried I can't get it to work.
When going into a sub-category, the category box still shows.
Here is an example
http://www.nhdirectory.net/law/law-firms/
Please excuse the apperance of it, have only been working on the header/index/footer and so the other pages do not work right yet.
Thanks.
You need to put it inside of {if $categories}here is the code for your category box{/if}
sdawkins
08-07-2006, 01:50 AM
This is what I have
{if $categories}
<div class="box">
<div class="caption"> <span class="centerTopTitle3">{$lang.categories}</span></div>
<div class="box-content">
{$categories}
</div></div>
{/if}
Post your whole index.tpl
sdawkins
08-07-2006, 02:15 AM
ok --
{include file="header.tpl"}
<td width="55%" class="center">
<table border=0 cellpadding=10 cellspacing=0>
<tr>
<td>
{if $category.description}
{$category.description}
{/if}
</td></tr>
<tr><td>
{if $categories}
<div class="box">
<div class="caption"> <span class="centerTopTitle3">{$lang.categories}</span></div>
<div class="box-content">
{$categories}
</div></div>
{/if}
{if $links}
<span class="centerTopTitle">
{$lang.links}</span>
<div class="box">
<div class="links">
{navigation aTotal=$total_links aTemplate=$url aItemsPerPage=$config.num_index_links aLinksPerPage=$config.num_navig_pages aType=2}
<table cellspacing="0" cellpadding="0">
{foreach from=$links item=link}
{include file="link-display.tpl"}
{/foreach}
</table>
</div>
<!-- START VISITOR SORTING CODE -->
{if $config.visitor_sorting}
<div class="link-sorting">{$lang.sort_links_by}
{foreach from=$sortings item=order}
{if $order eq $config.links_sorting}
{$lang.$order}
{else}
<a href="{$smarty.server.REQUEST_URI|add_url_param:'order': $order}">{$lang.$order}</a>
{/if}
{/foreach}
</div>
{/if}
<!-- END VISITOR SORTING CODE -->
</div>
{/if}
</td></tr>
<tr><td>
{if $related_categories}
<div class="box" style="margin-bottom: 10px;">
<h3 class="title">{$lang.related_categories}</h3>
<div class="box-content clearfix">{$related_categories}</div>
</div>
{/if}
</td></tr>
<tr><td>
{if $neighbour_categories}
<div class="box" style="margin-bottom: 10px;">
<h3 class="title">{$lang.neighbour_categories}</h3>
</div>
<div class="box-content clearfix">{$neighbour_categories}</div>
</div>
{/if}
</td></tr>
</table>
</td>
{include file="footer.tpl"}
sdawkins
08-07-2006, 02:17 AM
I might have to do a reinstall because when I add 'pages' and add it to my language file, they do not show up in the menu.
The code looks fine...
All I can suggest is to delete everything from tmp folder.
sdawkins
08-07-2006, 02:34 AM
The code looks fine...
All I can suggest is to delete everything from tmp folder.
Did that, numerous times...... do you think this code in the header is causing the problem (with cats)
{if ($category.id) >"0"}
<span class="centerTopTitle">{$lang.categories}</span>
{foreach from=$top_categories item=top_category}
<p><a href="{$config.base}{$config.dir}{$top_category.path}/">{$top_category.title}</a></p>
{/foreach}
</div>
{else}{/if}
If this code is in the same columh that this is it.
Try to remove this block and see what hapens
Just checked it again: the box is below category describtion so this is not the code from the header.
Sorry Sharon, I don't see anything wrong - this box is not supposed to be there if there is no categories :(
sdawkins
08-07-2006, 03:09 AM
That is the block I put where I want the categories in the left panel. Hmm.
Will give it a go in the morning, also going to probably delete the database and reinstall.
Vincent Wright
08-07-2006, 03:21 AM
I read the whole thread and failed to understand what the problem is. You wrote
I am using the modification to show the categories in the left menu (except on the main page.)
And posted a URL to check. I checked the URL and the categories are displayed in the left column.
So, what is wrong?
sdawkins
08-07-2006, 03:23 AM
Right, but when in a subcat (link above) the category box shows up with nothing in it.
Not the one in the left column, the one in the center section. If no subcategories, that box should not show I think...?
Vincent Wright
08-07-2006, 03:27 AM
Well, was there anything before you applied the mod?
sdawkins
08-07-2006, 03:31 AM
Couldn't remember, so I just removed the code to list the
categories in the left column, and still have the issue with the empty subcats box showing up
sdawkins
08-07-2006, 03:32 AM
Since the code appears correct, and I am having trouble adding pages to the menu, I am going to delete the installation and try it again.
But if you think of something wrong with the code, please let me know
Vincent Wright
08-07-2006, 03:49 AM
Well, I'm not sure about wrong code. Probably, fresh installation is the best option right now.
sdawkins
08-07-2006, 03:59 AM
weird, it just stopped doing it.
Vincent Wright
08-07-2006, 04:01 AM
Ok, I understand, reinstalling might be a pain.
Well, I still don't understand what went wrong. I need to know what was displayed before you applied the mod and what is now missing. Probably then I will be able to advise anything or take a look at your code.
sdawkins
08-07-2006, 04:07 AM
I'm going to reinstall now.
Vincent Wright
08-07-2006, 04:13 AM
Ok, feel free to ask if you need assistance.
sdawkins
08-07-2006, 04:25 AM
Well, that issue is working...but the adding new page is not.
I go to admin -- ad new page. Requesting it to go in the top menu.
Then add the new info to the language.
Upload files....go onto website, new page not there. Now, I've done this 100 times but heavens know I am ditzy sometimes I maybe I am missing something.
So, the new page does not appear in the $menu
And I just reinstalled the script and into a clean database.
Vincent Wright
08-07-2006, 04:47 AM
May I try it for myself in your admin panel?
sdawkins
08-07-2006, 11:48 AM
May I try it for myself in your admin panel?
Will email you credentials.
Sharon
sdawkins
08-07-2006, 05:27 PM
Vincent, I totally deleted everything and created a new db and now it is working.
So I don't know......weirdness....
Vincent Wright
08-07-2006, 06:41 PM
Yes, strange.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.