This method may be OK if your module is a simple project with only a few pages in it. The main drawback is that it breaks with the Xoops rules, so whatever you do now may not work in the next version of Xoops. Don't use this if you plan a public release of your module! It's only mentioned here to be used in your own small custom-made projects.
The biggest pro of the method is that you don't have to update anything while coding, you just save your code, press F5 and you see the results onscreen.
To print stuff onscreen using this method you only need to edit your index.php file.
* <?php *
require_once("../../mainfile.php");
o $myArray = array("Tribal Tech", "Face First", "Tuna Laguna", "Try it!", "Hoven Droven", "Swedish folk music done cool");
* include XOOPS_ROOT_PATH."/header.php";
* echo "| My Module Table | |
| ".$myArray[$i]."-> | ";".$myArray[$i]." |
* include XOOPS_ROOT_PATH."/footer.php"; * ?>
Quick and dirty. You could get away with a single echo call by assembling a string with .= and using echo to output things at the bottom. Refactoring:
The index.php file may get large and messy as our module grows. It may be a good idea to clean things up by creating a folder "includes" with a file "functions.php" inside it:
* <? //functions.php
* function getTable()
* {
* $myArray = array("Richard Nixon", "American Hero", "George W. Bush", "Vegetable", "Hoven Droven", "Swedish Folk Music done cool");
* $str = "| My Module Table | |
| ".$myArray$i?."-> | ";".$myArray$i?." |
* return $str; * } * ?>
This way we can get away with a smaller index.php file, and it'll be easier to see what we're talking about.
* <?php //index.php
* require_once("../../mainfile.php");
* include XOOPS_ROOT_PATH."/include/functions.php";
* // this line must be defined BEFORE header.php
* $xoopsOption['template_main'] = "earplane_main.html";
* include XOOPS_ROOT_PATH."/header.php";
* echo getTable();
* include XOOPS_ROOT_PATH."/footer.php";
* ?>
Now let's continue with outputting the string to a simple template instead of using the echo statement... Other parts:
1.2.2 using a simple template
1.2.3 an active template
back to dev:Tutorials

![[Main Page]](/modules/mediawiki/images/mediawiki.png)





