TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

May 18, 2024, 02:29:16 PM

Login with username, password and session length
Members
  • Total Members: 3,886
  • Latest: Grendor
Stats
  • Total Posts: 195,189
  • Total Topics: 21,220
  • Online today: 112
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 1
  • Guests: 56
  • Total: 57
  • @rjen

SMF Links Last X Links Block

Started by akulion, December 01, 2006, 04:03:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

akulion

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

Please Note: This block will only work if you use the mod!

Rebecca

Awesome thank you! Just wondering if its possible to make the text shown smaller?

alhaudhie


IchBin

If the links mod has a random links feature, you should ask the author if they could show you the code.

alhaudhie

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

IchBin

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.

alhaudhie

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:

alhaudhie

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?