1
Hi, my knowledge of PHP is still zip, and my knowledge of XOOPS core functions/classes and whatever is even more zipper. But I needed some headline blocks for my site very bad. So I decided to just copy and paste some things, squeeze a little, and at the end (to my own surprise) it seems to work. Now please give me your comments and advice on this pile of sh.t I created.
Added four blocks (example is for one block.
Blockies :
Xoops_version.php : Added :
Quote:
$modversion['blocks'][7]['file'] = "infohead.php";
$modversion['blocks'][7]['name'] = _BK_BNAME7;
$modversion['blocks'][7]['description'] = _BK_BNAME7_DESC;
$modversion['blocks'][7]['show_func'] = "b_blockies_infohead_show";
$modversion['blocks'][7]['edit_func'] = "b_blockies_infohead_edit";
$modversion['blocks'][7]['options'] = "0";
$modversion['blocks'][7]['template'] = 'block_headline.html';
In the language/english directory
blocks.php : Added :
Quote:
// Info Header News block
define("_BK_IH_NUM", "ID of news to display");
In the language/english directory
modinfo.php : Added :
Quote:
define("_BK_BNAME7","Rainbow Shaman");
define("_BK_BNAME7_DESC","Blockies: Info News block 1");
Then I copied the file headline.php to infohead.php and changed the function infohead_show :
Quote:
// Changed this
// $headline = $news[0];
// To this
$storyid = $options[0];
$headline = new NewsStory($storyid);
// End change
And copied changed the edit function of random news to :
Quote:
function b_blockies_infohead_edit($options){
include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
$num = new XoopsFormText('', "options[0]", 5, 2, $options[0]);
$num = $num->render();
$form[] = _BK_IH_NUM." ".$num;
$ret = '';
foreach( $form as $item ){
$ret .= $item."<br />";
}
return $ret;
}
Ok, hit me
Aloha