View Full Version : Adding category title by link display
I will like to show the category title by the link display for the top links page. How do modify the code below to achieve that?
Thanks!
function getTopLinks($aStart = 0, $aLimit = 0, $aEditor = '')
{
$sql = "SELECT t1.*, `t1`.`comments_active` `comments` , t9.`path` ";
$sql .= $aEditor ? ', IF((`t1`.`id_editor` IS NULL) OR (`t1`.`id_editor` = \'0\'), \'0\', \'1\') `id_editor_edit` ' : ', \'0\' `id_editor_edit` ';
$sql .= "FROM `{$this->mPrefix}links` t1 ";
$sql .= "LEFT JOIN `{$this->mPrefix}link_categories` t8 ";
$sql .= "ON t1.`id` = t8.`id_link` ";
$sql .= "AND t8.`crossed` = '0' ";
$sql .= "LEFT JOIN `{$this->mPrefix}categories` t9 ";
$sql .= "ON t8.`id_category` = t9.`id` ";
$sql .= "WHERE t1.`status` = 'active' ";
$sql .= "AND t9.`status` = 'active' ";
$sql .= "GROUP BY t1.`id` ";
$sql .= "ORDER BY t1.`rank` DESC ";
$sql .= $aLimit ? "LIMIT {$aStart}, {$aLimit}" : '';
return $this->mDb->getAll($sql);
}
Sergey Ten
01-27-2007, 05:19 PM
Hello sage!
As I understood you want to display "top links" in the "link details" page.
[ Open your view-link.php ]
[ Find code ]
$gDirSmarty->assign_by_ref('link', $link);
[ After add that code ]
/** gets top links **/
$top_links =& $gDirDb->getTopLinks(0, 10);
$gDirSmarty->assign_by_ref('top_links', $top_links);
[ Save change ]
[ Open your templates/your_template/view-link.tpl ]
[ Find code ]
{if $config.alexa_traffic}
<td>
<script type="text/javascript" src="http://xsltcache.alexa.com/traffic_graph/js/g/a/1m?amzn_id=esyndicatfree-20&u={$link.url}"></script>
</td>
{/if}
</tr>
</table>
</div>
</div>
[ After add that code ]
<div class="box">
<div class="box-caption-left">
<div class="box-caption">{$lang.top_links}</div>
</div>
<div class="box-content">
<div class="links">
<table cellspacing="0" cellpadding="0">
{foreach from=$top_links item=link}
{include file="link-display.tpl"}
{/foreach}
</table>
</div>
</div>
</div>
[ Save change ]
Thanks Sergey.
Unfortunately, it is show as 'Top Links' by the link title instead of the category title.
Please take a look at it.
http://modelarcade.com/arcade/top-links.html
Dave Baker
01-28-2007, 05:33 PM
Hello sage,
Please try it:
***Open file view-link.php and find code***
/** breadcrumb formation **/
$bc['viewlink']['url'] = '';
$bc['viewlink']['caption'] = $gDirLang['view_link'];
$breadcrumb = $gDirLayout->print_breadcrumb($category['id'], $bc, 1);
$gDirSmarty->assign_by_ref('breadcrumb', $breadcrumb);
***Below this code add***
/** categories box formation **/
$num_subcategories = $gDirConfig['subcats_display'] ? $gDirConfig['subcats_display'] : 0;
$categories =& $gDirDb->getCategoriesByParent(0, FALSE, $num_subcategories);
$categories = $categories ? $gDirLayout->print_categories($categories, $gDirConfig['num_categories_cols'], $num_subcategories) : '';
$gDirSmarty->assign_by_ref('categories', $categories);
***Save file***
***Open file templates/yourTemplate/view-link.tpl and find code***
{include file="header.tpl"}
<h1><a href="{$link.url}" id="l{$link.id}" {if $config.new_window}target="_blank"{/if}>{$link.title}</a></h1>
{if $msg}
<div class="{$type}"><ol>{$msg}</ol></div>
{/if}
***Below this code add (for Ocean template)**
{if $categories}
<div class="box">
<div class="box-caption-right">
<div class="box-caption-left">
<div class="box-caption">{$lang.categories}</div>
</div>
</div>
{$categories}
<div class="box-footer-right">
<div class="box-footer-left">
<div class="box-footer"></div>
</div>
</div>
</div>
{/if}
***Save file***
vBulletin® v3.7.0, Copyright ©2000-2009, Jelsoft Enterprises Ltd.