- Moderated by:
- Support Team
-
- rank:
-
Softmore
- registered:
- February 2005
- Status:
- offline
- last visit:
- 04.02.06
- Posts:
- 74
Ok...I'm looking at the Example module and its FULL of stuff....lots and lots of files, and I'm unsure where to begin...I want to write a module that will basically display a predefined text string on screen based on parameters passed. Kinda like a Hello World...
No admin functions, no database, nothing fancy...just when you call yoursite.com/index.php?name=Hello you get the text displayed...
What files from the example can I eliminate to make it the simplest approach? -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.11.08
- Posts:
- 13413
Code
function Hello_user_main()
{
// Get message from URL screen
$message = pnVarCleanFromInput('message');
// Create output object
$pnRender = new pnRender('Hello');
// Assign message to template
$pnRender->assign('mymsg', $message);
// Return / fetch output template
return $pnRender->fetch(Hello_user_main.htm);
}
Then in modules/Hello/pntemplates/Hello_user_main.htm:
Code
<!--[$mymsg]-->
Call the module with
index.php?module=Hello&message=HelloWorld
Code from memory and just typed into the forum, hope it works for you (and if any of it is broken, feel free to check against the example module for how it should be done).
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.11.08
- Posts:
- 13413
Quote
And your site is open for XSS Smile Always use
That's true, me trying to over simplify :)
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide -
- rank:
-
Steering Committee
- registered:
- December 2002
- Status:
- offline
- last visit:
- 09.11.08
- Posts:
- 13413
Well, you don't have to make the message a URL variable. You could make it a language define if you wanted.
--
Regards,
Simon
itbegins.co.uk - Zikula Consulting
Please read the Support Guide
