PDA

View Full Version : How to Put Placeholder Text in Empty Categories


Michele
07-15-2006, 07:32 PM
I didn't like the way empty categories looked and figured there had to be someplace where I could put some generic text instead - even if it was the same across every category.

I figured this out by a little trial and error and thought I would share.

Edit your templates/<template you are using>/index.tpl file.

Find the code similar to: (I'm using Kinky template)

{if $links}
<div class="box">
<div class="box-caption">{$lang.links}</div>
<div class="box-content">
<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}&nbsp;&nbsp;

{if $config.links_sorting_type eq 'ascending'}
{$lang.ascending} |
<a href="{$smarty.server.REQUEST_URI|add_url_param:'order_t ype':descending}">{$lang.descending}</a>
{else}
<a href="{$smarty.server.REQUEST_URI|add_url_param:'order_t ype':ascending}">{$lang.ascending}</a> |
{$lang.descending}
{/if}
</div>
{/if}
<!-- END VISITOR SORTING CODE -->
</div>
</div>
{/if}


Before the {/if} and after the second </div> put the following:


{else}
<div class="box">
<p>You could be the first to list in this category!</p>
</div>


I did create a class and use an H1 tag instead of a paragraph tag.

If anyone knows how to make this say the category name that would be even better! My attempts only got the last top category in my database. :rolleyes:

A little cosmetic suggestion too...When a category is empty but has subcategories, the text looked kinda stupid just hanging under the subcategory list so I also made the following change:

In the same file just above the long section quoted above add an <hr> tag as shown:


{if $categories}
<h1>Subcategories</h1>
<div class="box">
{$categories}
</div>
<hr />
{/if}

Simon Gooffin
07-17-2006, 11:48 AM
Hi
Thanks for the modification.
If anyone knows how to make this say the category name that would be even better! My attempts only got the last top category in my database.
Please try to change that text to the following:
<p>You could be the first to list in this category - {$category.title}</p>

zeromaster
07-17-2006, 10:36 PM
I dont get it. What exactly do I need to put in the theme editor? I am using reality theme.

redeye
07-17-2006, 10:54 PM
zeromaster

You don't make changes like the above in the theme editor. that is purely for CSS changes.


You need to download the file, copy it (just incase), make the changes and then upload it back to your server.

sdawkins
07-20-2006, 12:08 AM
I just tried this but it left that message in 'root', what do i need to add to change it from showing on the root end? I know it will be some something with this $category.id eq 0

Greg
07-20-2006, 03:47 PM
I just tried this but it left that message in 'root', what do i need to add to change it from showing on the root end? I know it will be some something with this $category.id eq 0

Try this:
{if $category.id > 0}
This text and link will appear only on category and sub category pages and not on the main page.
{/if}

sdawkins
07-20-2006, 04:26 PM
Perfect!!!! Thanks

:cool-yo:

Greg
07-20-2006, 06:59 PM
No problem :)

sdawkins
07-21-2006, 12:32 AM
I put my message in a box with background
http://www.findtoplinks.com/law/law-firms/