Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
5 - 4 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Random links
by mjoel on 2007/12/8 3:43:21

topic bump..i got this working...!!

in macdonald previous post ...update the mylinks_top.php
with this

<?php // $Id: mylinks_top.php,v 1.11 2004/12/26 19:11:56 Onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // // <https://xoops.org/> // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // /****************************************************************************** * Function: b_mylinks_top_show * Input : $options[0] = date for the most recent links * hits for the most popular links * $block['content'] = The optional above content * $options[1] = How many reviews are displayes * Output : Returns the desired most recent or most popular links ******************************************************************************/ function b_mylinks_top_show($options) { global $xoopsDB; $block = array(); $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM ".$xoopsDB->prefix('mylinks_links')." WHERE status>0 ORDER BY ".$options[0]." DESC",$options[1],0); while($myrow = $xoopsDB->fetchArray($result)){ $link = array(); $title = $myts->makeTboxData4Show($myrow["title"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['title']) >= $options[2]) { $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."..."; } } $link['id'] = $myrow['lid']; $link['cid'] = $myrow['cid']; $link['title'] = $title; if($options[0] == "date"){ $link['date'] = formatTimestamp($myrow['date'],'s'); }elseif($options[0] == "hits"){ $link['hits'] = $myrow['hits']; } $block['links'][] = $link; } return $block; } function b_mylinks_random( $options ) { global $xoopsDB; $block = array(); $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB -> query("SELECT lid, cid, title, url, logourl, date FROM " . $xoopsDB -> prefix('mylinks_links') . " WHERE status>0 ORDER BY RAND()"); while($myrow = $xoopsDB->fetchArray($result)){ $link = array(); $title = $myts->makeTboxData4Show($myrow["title"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['title']) >= $options[2]) { $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."..."; } } $link['id'] = $myrow['lid']; $link['cid'] = $myrow['cid']; $link['title'] = $title; $link['url'] = $myrow['url']; $link['logourl'] = $myrow['logourl']; $link['date'] = formatTimestamp($myrow['date'],'s'); $block['links'][] = $link; } return $block; } function b_mylinks_top_edit($options) { $form = ""._MB_MYLINKS_DISP."&nbsp;"; $form .= "<input type='hidden' name='options[]' value='"; if($options[0] == "date"){ $form .= "date'"; }else { $form .= "hits'"; } $form .= " />"; $form .= "<input type='text' name='options[]' value='".$options[1]."' />&nbsp;"._MB_MYLINKS_LINKS.""; $form .= "&nbsp;<br>"._MB_MYLINKS_CHARS."&nbsp;<input type='text' name='options[]' value='".$options[2]."' />&nbsp;"._MB_MYLINKS_LENGTH.""; return $form; } function b_mylinks_random_edit( $options ) { $form = "" . _MB_MYLINKS_DISP . "&nbsp;"; $form .= "<input type='hidden' name='options[]' value='"; $form .= "random'"; $form .= " />"; $form .= "<input type='text' name='options[]' value='" . $options[1] . "' />&nbsp;" . _MB_MYLINKS_LINKS . ""; $form .= "&nbsp;<br />" . _MB_MYLINKS_CHARS . "&nbsp;<input type='text' name='options[]' value='" . $options[2] . "' />&nbsp;" . _MB_MYLINKS_LENGTH . ""; return $form; } ?>
Re: Random links
by McDonald on 2007/10/13 19:04:59

There are some typos in mylinks/blocks/mylinks_top.php
Replacing it with this one should fix it:
<?php // $Id: mylinks_top.php,v 1.11 2004/12/26 19:11:56 Onokazu Exp $ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000 XOOPS.org // // <https://xoops.org/> // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program; if not, write to the Free Software // // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // ------------------------------------------------------------------------ // /****************************************************************************** * Function: b_mylinks_top_show * Input : $options[0] = date for the most recent links * hits for the most popular links * $block['content'] = The optional above content * $options[1] = How many reviews are displayes * Output : Returns the desired most recent or most popular links ******************************************************************************/ function b_mylinks_top_show($options) { global $xoopsDB; $block = array(); $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB->query("SELECT lid, cid, title, date, hits FROM ".$xoopsDB->prefix('mylinks_links')." WHERE status>0 ORDER BY ".$options[0]." DESC",$options[1],0); while($myrow = $xoopsDB->fetchArray($result)){ $link = array(); $title = $myts->makeTboxData4Show($myrow["title"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['title']) >= $options[2]) { $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."..."; } } $link['id'] = $myrow['lid']; $link['cid'] = $myrow['cid']; $link['title'] = $title; if($options[0] == "date"){ $link['date'] = formatTimestamp($myrow['date'],'s'); }elseif($options[0] == "hits"){ $link['hits'] = $myrow['hits']; } $block['links'][] = $link; } return $block; } function b_mylinks_random( $options ) { global $xoopsDB; $block = array(); $myts =& MyTextSanitizer::getInstance(); $result = $xoopsDB -> query("SELECT lid, cid, title, url, logourl, date FROM " . $xoopsDB -> prefix('mylinks_links') . " WHERE status>0 ORDER BY RAND() LIMIT 1 "); while($myrow = $xoopsDB->fetchArray($result)){ $link = array(); $title = $myts->makeTboxData4Show($myrow["title"]); if ( !XOOPS_USE_MULTIBYTES ) { if (strlen($myrow['title']) >= $options[2]) { $title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."..."; } } $link['id'] = $myrow['lid']; $link['cid'] = $myrow['cid']; $link['title'] = $title; $link['url'] = $myrow['url']; $link['logourl'] = $myrow['logourl']; $link['date'] = formatTimestamp($myrow['date'],'s'); $block['links'][] = $link; } return $block; } function b_mylinks_top_edit($options) { $form = ""._MB_MYLINKS_DISP."&nbsp;"; $form .= "<input type='hidden' name='options[]' value='"; if($options[0] == "date"){ $form .= "date'"; }else { $form .= "hits'"; } $form .= " />"; $form .= "<input type='text' name='options[]' value='".$options[1]."' />&nbsp;"._MB_MYLINKS_LINKS.""; $form .= "&nbsp;<br>"._MB_MYLINKS_CHARS."&nbsp;<input type='text' name='options[]' value='".$options[2]."' />&nbsp;"._MB_MYLINKS_LENGTH.""; return $form; } function b_mylinks_random_edit( $options ) { $form = "" . _MB_MYLINKS_DISP . "&nbsp;"; $form .= "<input type='hidden' name='options[]' value='"; $form .= "random'"; $form .= " />"; $form .= "<input type='text' name='options[]' value='" . $options[1] . "' />&nbsp;" . _MB_MYLINKS_LINKS . ""; $form .= "&nbsp;<br />" . _MB_MYLINKS_CHARS . "&nbsp;<input type='text' name='options[]' value='" . $options[2] . "' />&nbsp;" . _MB_MYLINKS_LENGTH . ""; return $form; } ?>


And change the content of mylinks_block_random.html to:
le="color: #000000"><?php <{foreach item=link from=$block.links}> <div align="center"> <a href="<{$xoops_url}>/modules/mylinks/visit.php?cid=<{$link.cid}>&lid=<{$link.id}>"><{$link.title}></a> <br /> <{$link.date}> <br /> <a href="<{$xoops_url}>/modules/mylinks/visit.php?cid=<{$link.cid}>&lid=<{$link.id}>" target="_blank"> <img src="<{$xoops_url}>/modules/mylinks/images/shots/<{$link.logourl}>" width="88" height="31" alt=""/></a> </div> <{/foreach}>


Now you also have the option to set the amount of random links displayed in the block, but the setting isn't used...yet.
Re: Random links
by mjoel on 2007/10/13 18:25:33

thanks Mc you have been a great help

i will try to modify it myself on the number of random links to be display..if i'm successful i will post it here

Re: Random links
by McDonald on 2007/10/13 13:07:32

Quote:

mjoel wrote:

just one more question....
it is possible to include the the option to choose how many random links to be display just like the recent and top links block....


I am working on that for XoopsTube already.
Creating the option is not the problem, but making it work is...
Re: Random links
by mjoel on 2007/10/13 12:31:48

thanks brother

just one more question....
it is possible to include the the option to choose how many random links to be display just like the recent and top links block....

Who's Online

344 user(s) are online (294 user(s) are browsing Support Forums)


Members: 0


Guests: 344


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits