<?php
/*
* E-Xoops module demonstration
*
* @author Bob Janes <bob@bobjanes.com>
*
*/
include ("../../mainfile.php");
include (XOOPS_ROOT_PATH."/header.php");
global $xoopsTheme;
$title = "Page Title";
$content = "All the things I want to say on my page";
global $db,$myts;
$query="SELECT * from ".$db->prefix("myquotes");
$result = $db->query($query);
$num_quotes = $db->num_rows($result);
$quote_no = rand(1, $num_quotes) - 1;
$content = mysql_result($result, $quote_no, 'quotes');
themecenterbox_center ($title, $content);
include (XOOPS_ROOT_PATH."/footer.php");
?>
mymodule/page2.php
<?php
/*
* E-Xoops module demonstration
*
* @author Bob Janes <bob@bobjanes.com>
*
*/
include ("../../mainfile.php");
include (XOOPS_ROOT_PATH."/header.php");
global $xoopsTheme;
$title = "Page 2 Title";
$content = "All the things I want to say on my second page";
themecenterbox_center ($title, $content);
include (XOOPS_ROOT_PATH."/footer.php");
?>
mymodule/blocks/index.html
<script>history.go(-1);</script>
mymodule/blocks/mymodule.html
<?php
/*
* E-Xoops module demonstration
*
* @author Bob Janes <bob@bobjanes.com>
*
*/
function b_mymodule_show($options) {
$title = "Block Title";
$content = "All the things I want to say in my block. ";
$num = rand(0,2);
$content .= "This ".$options[3]." is a ".$options[$num]." ".$options[3].".";
$block['title'] = $title;
$block['content'] = $content;
return $block;
}
function b_mymodule_edit($options) {
$form = "<input type='hidden' name='options[0]' value='".$options[0]."'>";
$form .= "<input type='hidden' name='options[1]' value='".$options[1]."'>";
$form .= "<input type='hidden' name='options[2]' value='".$options[2]."'>";
$form .= "kind of . . . <input type='text' size='8' maxlength='8' name='options[3]' value='".$options[3]."'>";
return $form;
}
?>
mymodule/language/english/modinfo.php
<?php
/*
* E-Xoops module demonstration
*
* @author Bob Janes <bob@bobjanes.com>
*
*/
define("_MI_MYMODULE_NAME","Mymodule");
define("_MI_MYMODULE_DESC","Shows text in a box");
define("_MI_MYMODULE_BNAME","My Block");
define("_MI_MYMODULE_BDESC","Shows more text in a box");
?>
mymodule/sql/mysql.sql
INSERT INTO myquotes
VALUES (1, 'Constant change is here to stay.');
INSERT INTO myquotes
VALUES (2, '11th Commandment: covet not thy neighbours Pentium.');
INSERT INTO myquotes
VALUES (3, '1st rule of intelligent tinkering - save all the parts');
INSERT INTO myquotes
VALUES (4, '90% of all statistics are made up');
INSERT INTO myquotes
VALUES (5, 'A day for firm decisions!!!!! Or is it?');