1
svaha
First victim : Blockies
  • 2004/1/22 19:14

  • svaha

  • Just can't stay away

  • Posts: 896

  • Since: 2003/8/2 2


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

Login

Who's Online

133 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 133


more...

Donat-O-Meter

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

Latest GitHub Commits