1
fmiguel
changes in Spotlight module
  • 2006/7/29 18:33

  • fmiguel

  • Just popping in

  • Posts: 17

  • Since: 2006/3/29


Hi all;

I'm trying to modify spotlight module in this way: show 3 news, category news in one block (c-left) and other 3 news category events in other block (c-right).
My first step is: show the last three news in spotlight block like the first notice choice, in preferences of module and not with topics. Include three thumb images.

My code:

//kuht_head.php

include_once(XOOPS_ROOT_PATH.'/class/xoopsstory.php');
include_once(XOOPS_ROOT_PATH.'/class/module.textsanitizer.php');
function b_head_kuht_show($options)
{
global $xoopsDB, $xoopsConfig;
$myts =& MyTextSanitizer::getInstance();
$fhometext = "";
$block = array();
$block['title'] = _MB_KUHT_TITLE_SPOTLIGHT;
$tdate = mktime(0,0,0,date("n"),date("j"),date("Y"));

$block['lang_by'] = _MB_KUHT_BY;
$block['lang_read'] = _MB_KUHT_READ;
$block['lang_comments'] = _MB_KUHT_COMMENTS;
$block['lang_write'] = _MB_KUHT_WRITE;
$block['lang_othernews']= _MB_KUHT_OTHERNEWSTEXT;


$result = $xoopsDB->query("SELECT storyid, uid, title, hometext, comments FROM ".$xoopsDB->prefix("stories")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") ORDER BY published DESC LIMIT 3",1,0);


while ( $block = mysql_fetch_array ( $result, MYSQL_ASSOC )){
foreach ($block as $chave => $valor){
$block[$chave][] = $valor;
}
}

for ( $i=0; $i<3; $i++){
if (!$block[$i]['id'] && !$block["$i"]['title']) {
$block["$i"]['message'] = _MB_KUHT_NOTSELECT;
} else {
if ($auto_image == 0) {
$block["$i"]['image'] = $image;
} //else {
//$var_image = $xoopsDB->query("SELECT topicid FROM ".$xoopsDB->prefix("stories")." WHERE storyid=".$number."",1,0);
//list ($patt_image) = $xoopsDB->fetchblock($var_image);
//$var_image2 = $xoopsDB->query("SELECT topic_imgurl FROM ".$xoopsDB->prefix("topics")." WHERE topic_id=".$patt_image."",1,0);
//list ($image_display) = $xoopsDB->fetchblock($var_image2);
$block["$i"]['image_display'] = $image_display;
}

if (!XOOPS_USE_MULTIBYTES) {
if (strlen($block["$i"]['title']) >= $options[0]) {
$block["$i"]['title'] = substr($block["$i"]['title'],0,($options[0] -1))."...";
}
}
$block["$i"]['title'] = $myts->makeTboxData4Show($block["$i"]['title']);
//$block['uid'] = $myts->makeTboxData4Show($uidutente);
//$block['author'] = $myts->makeTboxData4Show($fautorevero);
$block["$i"]['hometext'] = $myts->xoopsCodeDecode($block["$i"]['hometext']); // BB Codes
$block["$i"]['hometext'] = $myts->nl2Br($block["$i"]['hometext']);
$block["$i"]['storyid'] = $myts->makeTboxData4Show($block["$i"]['storyid']);
$block["$i"]['comments'] = $myts->makeTboxData4Show($block["$i"]['comments']);

}
mysql_free_result ( $result );
return $block;

function b_head_kuht_edit($options)
{
$form = _MB_KUHT_TITLECHARS.'  '._MB_KUHT_TITLELENGTH.' 
';
$form.= ''._MB_KUHT_OTHERNEWS.'
';
$form.= _MB_KUHT_ORDER.' ';
$form.= _MB_KUHT_DISP.'  '._MB_KUHT_ARTCLS.'
';
$form.= _MB_KUHT_CHARS.'  '._MB_KUHT_LENGTH.'
';
$form.= _MB_KUHT_TOPICS.' ';
return $form;
?>

my template:



<{foreach item=block from=$block}>




<{if $xoops_userid != ""}>



<{/if}>


<{if $block.image != ""}>

<{else}>

<{/if}>

<{$block.hometext}>


<{$block.lang_read}>



<{$block.comments}> <{$block.lang_comments}> |

<{$block.lang_write}>




Anyone can help???

Thank you!

XOOPS Version: 2.0.13
Module Name/Version: Spotlight 1.4
PHP Version: 5
Web Server Software (Apache/IIS/Other): Apache
Operating System: Windows XP
Theme you are using: Default (for test)
Custom template: (Yes/No) I hope
PHP Debug Messages:
Warning [PHP]: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in file C:\apachefriends\xampp\htdocs\dev\modules\spotlight\blocks\kuht_head.php line 57
Notice [PHP]: Undefined offset: 0 in file C:\apachefriends\xampp\htdocs\dev\modules\spotlight\blocks\kuht_head.php line 68

Login

Who's Online

192 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 192


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits