Estoy creando un directorio usando un script gratuito llamado phpld2.1
Los 2 archivos del témplate que quiero modificar son main.tpl y link.tpl
main.tpl es el archivo que muestra las distintas categorías y subcategorías del directorio web, y mediante el código de mas abajo se consigue que cada categoría se represente con una imagen descriptiva distinta.
Digamos la Categoría Coches, pues la imagen correspondiente es la de un coche.
Ejemplo: Cat.1 = Coches = 1.png (1.png es la imagen de un coche)
Código PHP:
{if !empty($category.ID)}
<h3>{l}Categories{/l}</h3>
{/if}
<table border="0" cellpadding="0" cellspacing="2">
<tr>
{foreach from=$categs item=cat name=categs}
{if ($smarty.foreach.categs.iteration mod $cats_per_col eq 1 and $cats_per_col gt 1) or $smarty.foreach.categs.first}<td>{/if}
<h2>
{if $category.ID eq 0}<img src="{$smarty.const.DOC_ROOT}/images/cat/{$cat.ID}.png" border="0" alt="{$cat.TITLE}" align="left" style="margin-right: 10px; margin-top: 5px; margin-bottom: 5px;" />
{else}
<img src="{$smarty.const.DOC_ROOT}/images/cat/icon.png" border="0" alt="" style="margin-right: 2px;" />{/if}<a href="{if $smarty.const.ENABLE_REWRITE}{$cat.TITLE_URL|escape}/{else}index.php?c={$cat.ID}{/if}" title="{$cat.TITLE|escape}">{$cat.TITLE|escape}</a>{if $smarty.const.CATS_COUNT} <span class="count">({$cat.COUNT})</span>{/if}
</h2>
Este es el código completo de link.tpl
Código PHP:
{strip}
<table><tr>
{* show page rank *}
{if $smarty.const.SHOW_PAGERANK}
<td>
<img style="border: 1px solid #000000; height:100px; width:133px;" src="http://open.thumbshots.org/image.pxf?url={$link.URL|escape|trim}" alt="Screeshot of {$link.TITLE|escape|trim}" />
{include file="pagerank.tpl" pr=$link.PAGERANK}
</td>
{/if}
<td>
<a id="id_{$link.ID}" href="{$link.URL|escape|trim}" title="{$link.TITLE|escape|trim}"
{* nofollow *}
{if $link.NOFOLLOW or ($link.RECPR_VALID eq 0 and ($smarty.const.RECPR_NOFOLLOW eq 2 or ($smarty.const.RECPR_NOFOLLOW eq 1 and $link.RECPR_REQUIRED eq 1)))} rel="nofollow"{/if}
{if $smarty.const.ENABLE_BLANK} target="_blank"{/if}>
{$link.TITLE|escape|trim}</a> <span class="url">- {$link.URL|escape|trim}</span>
<p>{$link.DESCRIPTION|escape|trim}</p>
</td>
</tr></table>
{/strip}
De forma que cada enlace mostraría una imagen distinta o igual dependiendo de la categoría.
No se si me eh explicado claramente.??
Alguien que entienda de código que pueda echarme un cable.? se lo tendría muy agradecido.
Gracias de ante mano desde ya.
Salu2