Welcome to Geeklog, Anonymous Tuesday, April 01 2025 @ 08:51 pm EDT
Geeklog Forums
Mod to Dirk's BLOGROLL link block
Status: offline
BizzoMephisto655
Forum User
Newbie
Registered: 02/21/06
Posts: 1
Thanks to Dirk for making the link block. I just modified it a little to show hits and description for those who wanted it.
see it in action here www.tardisshed.com
thanks again Dirk...
bizzo
{
global $_CONF, $_TABLES;
// configuration options:
$cat = 'xxxxxxxxxxxxx'; // Category to take links from
$directlink = false; // Use direct links (true) or portal.php (false)
$random = false; // Random order (true) or sort by $sort (false)
$sort = 'date'; // Sort by ... e.g. 'date', 'title', 'url'
// === you shouldn't need to change anything below this line ==============
$retval = '';
$result = DB_query ("SELECT lid,url,title,description,hits FROM {$_TABLES['links']} WHERE category = '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
$numLinks = DB_numRows ($result);
$links = array ();
for ($i = 0; $i < $numLinks; $i++) {
$A = DB_fetchArray ($result);
if ($directlink) {
$url = $A['url'];
$link = '<a href="' . $url . '">';
} else {
$url = $_CONF['site_url']
. COM_buildUrl ('/portal.php?what=link&item=' . $A['lid']);
$link = '<a href="' . $url . '" title="' . $A['url'] . '">';
}
$links[] = $link . stripslashes ($A['title']) . '</a>' . ' (' . ($A['hits']) . ')' . '<br><i>' . ($A['description']) . '<br><br></i>';
}
if (count ($links) > 0) {
if ($random) {
$min = 0;
$max = count ($links) - 1;
$newlist = array ();
do {
$r = rand ($min, $max);
if (!empty ($links[$r])) {
$newlist[] = $links[$r];
unset ($links[$r]);
}
if ($r == $min) {
$min = $r + 1;
} else if ($r == $max) {
$max = $r - 1;
}
if ($min == $max) {
if (!empty ($links[$min])) {
$newlist[] = $links[$min];
}
break;
}
}
while ($max > $min);
$retval = COM_makeList ($newlist, 'list-blogroll');
} else {
$retval = COM_makeList ($links, 'list-blogroll');
}
}
return $retval;
}
see it in action here www.tardisshed.com
thanks again Dirk...
bizzo
Text Formatted Code
function phpblock_blogroll (){
global $_CONF, $_TABLES;
// configuration options:
$cat = 'xxxxxxxxxxxxx'; // Category to take links from
$directlink = false; // Use direct links (true) or portal.php (false)
$random = false; // Random order (true) or sort by $sort (false)
$sort = 'date'; // Sort by ... e.g. 'date', 'title', 'url'
// === you shouldn't need to change anything below this line ==============
$retval = '';
$result = DB_query ("SELECT lid,url,title,description,hits FROM {$_TABLES['links']} WHERE category = '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
$numLinks = DB_numRows ($result);
$links = array ();
for ($i = 0; $i < $numLinks; $i++) {
$A = DB_fetchArray ($result);
if ($directlink) {
$url = $A['url'];
$link = '<a href="' . $url . '">';
} else {
$url = $_CONF['site_url']
. COM_buildUrl ('/portal.php?what=link&item=' . $A['lid']);
$link = '<a href="' . $url . '" title="' . $A['url'] . '">';
}
$links[] = $link . stripslashes ($A['title']) . '</a>' . ' (' . ($A['hits']) . ')' . '<br><i>' . ($A['description']) . '<br><br></i>';
}
if (count ($links) > 0) {
if ($random) {
$min = 0;
$max = count ($links) - 1;
$newlist = array ();
do {
$r = rand ($min, $max);
if (!empty ($links[$r])) {
$newlist[] = $links[$r];
unset ($links[$r]);
}
if ($r == $min) {
$min = $r + 1;
} else if ($r == $max) {
$max = $r - 1;
}
if ($min == $max) {
if (!empty ($links[$min])) {
$newlist[] = $links[$min];
}
break;
}
}
while ($max > $min);
$retval = COM_makeList ($newlist, 'list-blogroll');
} else {
$retval = COM_makeList ($links, 'list-blogroll');
}
}
return $retval;
}
13
9
Quote
Status: offline
::Ben
Forum User
Full Member
Registered: 01/14/05
Posts: 1569
Location:la rochelle, France
This one work with Geeklog 1.5.0
function phpblock_blogroll ()
{
global $_CONF, $_TABLES;
// configuration options:
$cat = 'xxxxxxxxxxxxx'; // cid to take links from (e.g. If category is Geeklog Sites, cid is geeklog-sites
$directlink = false; // Use direct links (true) or portal.php (false)
$random = false; // Random order (true) or sort by $sort (false)
$sort = 'date'; // Sort by ... e.g. 'date', 'title', 'url'
// === you shouldn't need to change anything below this line ==============
$retval = '';
$result = DB_query ("SELECT lid,url,title,description,hits FROM {$_TABLES['links']} WHERE cid = '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
$numLinks = DB_numRows ($result);
$links = array ();
for ($i = 0; $i < $numLinks; $i++) {
$A = DB_fetchArray ($result);
if ($directlink) {
$url = $A['url'];
$link = '<a href="' . $url . '">';
} else {
$url = $_CONF['site_url']
. COM_buildUrl ('/portal.php?what=link&item=' . $A['lid']);
$link = '<a href="' . $url . '" title="' . $A['url'] . '">';
}
$links[] = $link . stripslashes ($A['title']) . '</a>' . ' (' . ($A['hits']) . ')' . '<br><i>' . ($A['description']) . '<br><br></i>';
}
if (count ($links) > 0) {
if ($random) {
$min = 0;
$max = count ($links) - 1;
$newlist = array ();
do {
$r = rand ($min, $max);
if (!empty ($links[$r])) {
$newlist[] = $links[$r];
unset ($links[$r]);
}
if ($r == $min) {
$min = $r + 1;
} else if ($r == $max) {
$max = $r - 1;
}
if ($min == $max) {
if (!empty ($links[$min])) {
$newlist[] = $links[$min];
}
break;
}
}
while ($max > $min);
$retval = COM_makeList ($newlist, 'list-blogroll');
} else {
$retval = COM_makeList ($links, 'list-blogroll');
}
}
return $retval;
}
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
Text Formatted Code
function phpblock_blogroll ()
{
global $_CONF, $_TABLES;
// configuration options:
$cat = 'xxxxxxxxxxxxx'; // cid to take links from (e.g. If category is Geeklog Sites, cid is geeklog-sites
$directlink = false; // Use direct links (true) or portal.php (false)
$random = false; // Random order (true) or sort by $sort (false)
$sort = 'date'; // Sort by ... e.g. 'date', 'title', 'url'
// === you shouldn't need to change anything below this line ==============
$retval = '';
$result = DB_query ("SELECT lid,url,title,description,hits FROM {$_TABLES['links']} WHERE cid = '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
$numLinks = DB_numRows ($result);
$links = array ();
for ($i = 0; $i < $numLinks; $i++) {
$A = DB_fetchArray ($result);
if ($directlink) {
$url = $A['url'];
$link = '<a href="' . $url . '">';
} else {
$url = $_CONF['site_url']
. COM_buildUrl ('/portal.php?what=link&item=' . $A['lid']);
$link = '<a href="' . $url . '" title="' . $A['url'] . '">';
}
$links[] = $link . stripslashes ($A['title']) . '</a>' . ' (' . ($A['hits']) . ')' . '<br><i>' . ($A['description']) . '<br><br></i>';
}
if (count ($links) > 0) {
if ($random) {
$min = 0;
$max = count ($links) - 1;
$newlist = array ();
do {
$r = rand ($min, $max);
if (!empty ($links[$r])) {
$newlist[] = $links[$r];
unset ($links[$r]);
}
if ($r == $min) {
$min = $r + 1;
} else if ($r == $max) {
$max = $r - 1;
}
if ($min == $max) {
if (!empty ($links[$min])) {
$newlist[] = $links[$min];
}
break;
}
}
while ($max > $min);
$retval = COM_makeList ($newlist, 'list-blogroll');
} else {
$retval = COM_makeList ($links, 'list-blogroll');
}
}
return $retval;
}
::Ben
I'm available to customise your themes or plugins for your Geeklog CMS
12
10
Quote
Status: offline
beewee
Forum User
Full Member
Registered: 08/05/03
Posts: 969
Location:The Netherlands, where else?
Quote by: 1000ideen
Thanks This tool should become part of the link plugin.
It would be nice if the Link plugin would offer the ability to assign an block to a certain link category, or let the link categories follow the story topics as well. Or just one single block already assigned to a pre-installed category Blogroll for a start.
I believe the coder from Glinks had something like that on his new features list. This piece of code would be insufficient since you have to put this in lib-custom.php and edit it to assign it to a category.
Dutch Geeklog sites about camping/hiking:
www.kampeerzaken.nl | www.campersite.nl | www.caravans.nl | www.caravans.net
9
13
Quote
All times are EDT. The time is now 08:51 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content