PDA

View Full Version : Putting newest links in index page


thorpeobazee
10-07-2006, 03:52 PM
I have seen web directories that have put in the newest or latest links in front of their directories. How do I do this?

Sergey Ten
10-07-2006, 04:20 PM
Welcome to our support forum thorpeobazee,

Please follow this directives:

*** Open your index.php and find 71 line ***


$gDirSmarty->assign('url', $gDirConfig['base'].$gDirConfig['dir'].$category['path'].'/index%1.html');


*** After this code add such code ***


/** get new links **/
$new_links =& $gDirDb->getNewLinks($start, $num_links);
$gDirSmarty->assign_by_ref('new_links', $new_links);


*** Save change ***


*** Open your templates/footer.tpl and find such code ***


{if $featured_links && $config.featured_box}
<div class="box">
<div class="box-caption2-right">
<div class="box-caption2-left">
<div class="box-caption2">{$lang.featured_links}</div>
</div>
</div>
<div class="box-content">
<div class="links">
{foreach from=$featured_links item=link}
<div class="featured-link"><a href="{$link.url}" class="title" id="l{$link.id}" {if $config.new_window}target="_blank"{/if}>{$link.title}</a></div>
{/foreach}
</div>
</div>
</div>
{/if}


*** After add this ***


{if $new_links}
<div class="box">
<div class="box-caption2-right">
<div class="box-caption2-left">
<div class="box-caption2">{$lang.featured_links}</div>
</div>
</div>
<div class="box-content">
<div class="links">
{foreach from=$new_links item=new_link}
<div class="featured-link"><a href="{$new_link.url}" class="title" id="l{$new_link.id}" {if $config.new_window}target="_blank"{/if}>{$new_link.title}</a></div>
{/foreach}
</div>
</div>
</div>
{/if}


*** Save change ***

thorpeobazee
10-07-2006, 07:16 PM
Thanks for the fast reply. Thanks for the welcome.

I wanted the new links below the directory. Not on the side. I am using the Green Leaves template.

Sergey Ten
10-07-2006, 08:07 PM
thorpeobazee,

OK, follow directives:

*** Add in your languages file this code ***


'new_links' => 'New links',


*** Change my code to ***


if($category['id'] > 0)
{
$new_links =& $gDirDb->getNewLinks($start, 5);
$gDirSmarty->assign_by_ref('new_links', $new_links);
}



{if $new_links}
<div class="box">
<div class="box-caption2-right">
<div class="box-caption2-left">
<div class="box-caption2">{$lang.new_links}</div>
</div>
</div>
<div class="box-content">
<div class="links">
{foreach from=$new_links item=new_link}
<div class="featured-link"><a href="{$new_link.url}" class="title" id="l{$new_link.id}" {if $config.new_window}target="_blank"{/if}>{$new_link.title}</a></div>
{/foreach}
</div>
</div>
</div>
{/if}


*** Save changes ***

thorpeobazee
10-07-2006, 11:52 PM
hmm.. I can't seem to make it work. I want to make clear what I did.

**I replaced this code that you said previously in the footer.tpl**

/** get new links **/
$new_links =& $gDirDb->getNewLinks($start, $num_links);
$gDirSmarty->assign_by_ref('new_links', $new_links);

** to **


if($category['id'] > 0)
{
$new_links =& $gDirDb->getNewLinks($start, 5);
$gDirSmarty->assign_by_ref('new_links', $new_links);
}



**footer.tpl should have this**

{if $featured_links && $config.featured_box}
<div class="box">
<div class="box-caption2-right">
<div class="box-caption2-left">
<div class="box-caption2">{$lang.featured_links}</div>
</div>
</div>
<div class="box-content">
<div class="links">
{foreach from=$featured_links item=link}
<div class="featured-link"><a href="{$link.url}" class="title" id="l{$link.id}" {if $config.new_window}target="_blank"{/if}>{$link.title}</a></div>
{/foreach}
</div>
</div>
</div>
{/if}

{if $new_links}
<div class="box">
<div class="box-caption2-right">
<div class="box-caption2-left">
<div class="box-caption2">{$lang.new_links}</div>
</div>
</div>
<div class="box-content">
<div class="links">
{foreach from=$new_links item=new_link}
<div class="featured-link"><a href="{$new_link.url}" class="title" id="l{$new_link.id}" {if $config.new_window}target="_blank"{/if}>{$new_link.title}</a></div>
{/foreach}
</div>
</div>
</div>
{/if}

and I added

'new_links' => 'New links',

to the language file, English.php

Thanks in advance

thorpeobazee
10-08-2006, 12:10 AM
I just want to clear out that this is what I want
http://img82.imageshack.us/img82/5057/siteesynkp7.th.gif (http://img82.imageshack.us/my.php?image=siteesynkp7.gif)

thorpeobazee
10-08-2006, 12:21 AM
I put this code to index.php page and it seems to work


{if $new_links}
<div class="box">
<div class="box-content">
<div class="links">
{if $config.mod_rewrite}{assign var="type" value=3}{else}{assign var="type" value=1}{/if}
{if $config.mod_rewrite}{assign var="url" value='new-links%1.html'}{else}{assign var="url" value='new-links.php?'}{/if}
{navigation aTotal=$total_links aTemplate=$url aItemsPerPage=$config.num_index_links aLinksPerPage=$config.num_navig_pages aType=$type}
<table cellspacing="0" cellpadding="0">
{foreach from=$new_links item=link}
{include file="link-display.tpl"}
{/foreach}
</table>
</div>
</div>
</div>
{/if}

I am not sure if I did it right and would be thankful if someone can tell me if I did any mistakes. Thank you very much

:)

thorpeobazee
10-08-2006, 12:30 AM
hmm.. I can see that there's a mistake. Irrelevant sites show up in all categories.

I want to put the newest links in the index page and I want to put the latest link in each category when I browse them.

Dave Baker
10-22-2006, 05:40 PM
Hello thorpeobazee,

Try this code:

{if $new_links AND $category.level eq 0}
<div class="box">
<div class="box-content">
<div class="links">
{if $config.mod_rewrite}{assign var="type" value=3}{else}{assign var="type" value=1}{/if}
{if $config.mod_rewrite}{assign var="url" value='new-links%1.html'}{else}{assign var="url" value='new-links.php?'}{/if}
{navigation aTotal=$total_links aTemplate=$url aItemsPerPage=$config.num_index_links aLinksPerPage=$config.num_navig_pages aType=$type}
<table cellspacing="0" cellpadding="0">
{foreach from=$new_links item=link}
{include file="link-display.tpl"}
{/foreach}
</table>
</div>
</div>
</div>
{/if}