| Author |
Message |
thundarfoot Regular


Joined: Jan 16, 2008 Posts: 75
|
Posted:
Mon Jan 21, 2008 5:25 am |
|
I am a noob. Here is my sign
I have written a small script in php that has a drop down select and displays the output of a mysql table. which is a huge victory for me.
I want to turn this into a module or block but I am not sure where to begin.
Can anyone point me to any good tutorials or have any advice for me?
Thanks in advance! |
|
|
|
 |
montego Site Admin

Joined: Aug 29, 2004 Posts: 9136 Location: Arizona
|
Posted:
Mon Jan 21, 2008 6:08 am |
|
In its most simplest form, here would be a model module: let us call the module Sample_Module. Create the following file:
modules/Sample_Module/index.php
Now, the basic structure of that index.php file could be:
| Code: |
<?php
if (!defined('MODULE_FILE')) die('You can\'t access this file directly...');
require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = '- You Module Name'; // If you need this to be multi-lingual then you will have to use language defines
include_once 'header.php';
OpenTable();
//your code goes here
CloseTable();
include_once 'footer.php';
?>
|
That should at least get you started in the right direction. Use other module's code as your "guide". |
|
|
|
 |
Gremmie Former Moderator in Good Standing

Joined: Apr 06, 2006 Posts: 2415 Location: Iowa, USA
|
Posted:
Mon Jan 21, 2008 1:22 pm |
|
Also google the PHP-Nuke How-To. It has some old info, but should get you started if you study it and existing modules.
There is also a book called "Building Websites with PHP-Nuke" by Paterson which discusses building modules, blocks, and modifying themes. |
|
|
|
 |
thundarfoot Regular


Joined: Jan 16, 2008 Posts: 75
|
Posted:
Mon Jan 21, 2008 3:56 pm |
|
|
|
 |
Gremmie Former Moderator in Good Standing

Joined: Apr 06, 2006 Posts: 2415 Location: Iowa, USA
|
Posted:
Mon Jan 21, 2008 4:58 pm |
|
Forgot that book is also available as a pdf download. |
|
|
|
 |
thundarfoot Regular


Joined: Jan 16, 2008 Posts: 75
|
Posted:
Mon Jan 21, 2008 6:00 pm |
|
Cool I will google for it, using the above example, and adding my script I have it working quite nice...
Except it is showing a active but invisible, and only seems to display for admin.
any ideas?
thanks for the example! |
|
|
|
 |
fkelly Moderator

Joined: Aug 30, 2005 Posts: 3186 Location: near Albany NY
|
Posted:
Mon Jan 21, 2008 6:45 pm |
|
You need to go into the admin control panel, select modules and edit that module to make it visible. |
|
|
|
 |
thundarfoot Regular


Joined: Jan 16, 2008 Posts: 75
|
Posted:
Mon Jan 21, 2008 11:57 pm |
|
|
|
 |
|
|
|
|