TinyPortal

Development => Block Codes => Topic started by: akulion on December 01, 2006, 04:03:29 PM

Title: SMF Links Last X Links Block
Post by: akulion on December 01, 2006, 04:03:29 PM
hi,

this is a code by vbGamer the developer of the SMF Links Mod

This block will give you the last X links posted in the links directory to change the limit change the LIMIT 5 in the code below

Download SSI.php file

and add this code to the end before the ?>


function ssi_links_recent()
{
global $scripturl,$db_prefix;

$dbresult = db_query("SELECT l.ID_LINK, l.rating, l.title,l.date, l.ID_MEMBER, l.description,l.hits FROM {$db_prefix}links AS l WHERE l.approved = 1 ORDER BY l.ID_LINK DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{

echo '<a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a><br />';


}
echo '<br />';
echo '<a href="' . $scripturl . '?action=links">Add Link</a>';

mysql_free_result($dbresult);
}


And then in the TP admin area create a PHP side block and add this to it:

ssi_links_recent();

Activate and enjoy.

The SMF links directory mod can be found on  page one of this thread at SMF (http://www.simplemachines.org/community/index.php?topic=98911.msg833689#msg833689)

Please Note: This block will only work if you use the mod!
Title: Re: SMF Links Last X Links Block
Post by: Rebecca on September 01, 2008, 12:17:40 AM
Awesome thank you! Just wondering if its possible to make the text shown smaller?
Title: Re: SMF Links Last X Links Block
Post by: alhaudhie on December 22, 2008, 04:22:15 PM
how about the random links?
Title: Re: SMF Links Last X Links Block
Post by: IchBin on December 22, 2008, 07:42:16 PM
If the links mod has a random links feature, you should ask the author if they could show you the code.
Title: Re: SMF Links Last X Links Block
Post by: alhaudhie on December 23, 2008, 02:07:12 AM
thanks.

now im using

function ssi_links_recent()
{
global $scripturl,$db_prefix;

$dbresult = db_query("SELECT l.ID_LINK, l.rating, l.title,l.date, l.ID_MEMBER, l.description,l.hits FROM {$db_prefix}links AS l WHERE l.approved = 1 ORDER BY l.ID_LINK DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{

echo '<a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a><br />';


}
echo '<br />';
echo '<a href="' . $scripturl . '?action=links">Add Link</a>';

mysql_free_result($dbresult);
}


this code show the latest/recent added links.
How can to make it show recent by category? Like

Recent Links
category 1
Link 1        Link2      Link3     Link4      Link5

category 2
Link 1        Link2      Link3     Link4      Link5

category 3

Link 1        Link2      Link3     Link4      Link5
Title: Re: SMF Links Last X Links Block
Post by: IchBin on December 23, 2008, 03:02:43 AM
Since Aku is not here, and I don't know anyone here that uses this mod, I would suggest you seek help from the author of the mod.
Title: Re: SMF Links Last X Links Block
Post by: alhaudhie on December 23, 2008, 03:45:20 AM
Quote from: IchBinâ,,¢ on December 23, 2008, 03:02:43 AM
Since Aku is not here, and I don't know anyone here that uses this mod, I would suggest you seek help from the author of the mod.
tq...

i miss Aku.... where is he now?   :2funny:
Title: Re: SMF Links Last X Links Block
Post by: alhaudhie on January 01, 2009, 04:11:47 PM
Quote from: alhaudhie on December 23, 2008, 02:07:12 AM
thanks.

now im using

function ssi_links_recent()
{
global $scripturl,$db_prefix;

$dbresult = db_query("SELECT l.ID_LINK, l.rating, l.title,l.date, l.ID_MEMBER, l.description,l.hits FROM {$db_prefix}links AS l WHERE l.approved = 1 ORDER BY l.ID_LINK DESC LIMIT 5", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{

echo '<a href="' . $scripturl . '?action=links;sa=visit;id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a><br />';


}
echo '<br />';
echo '<a href="' . $scripturl . '?action=links">Add Link</a>';

mysql_free_result($dbresult);
}


this code show the latest/recent added links.
How can to make it show recent by category? Like

Recent Links
category 1
Link 1        Link2      Link3     Link4      Link5

category 2
Link 1        Link2      Link3     Link4      Link5

category 3

Link 1        Link2      Link3     Link4      Link5

Anybody can help for this?