About Hello World
An example module used for demonstration purposes.
|Category||Proof of Concept|
Proof of concept modules are designed as examples or starting points for others to build from. May not be ideal for users wanting to plug-n-play.
Should be safe for use in production environments. *
|Compatibility||2.3, 2.4, 2.5, 2.6, 2.7, 3.0|
|Date Added||September 22, 2014|
This module's files should be placed in /site/modules/Helloworld/
How to install or uninstall modules
Demonstrates the Module interface and how to add hooks.This version of Helloworld requires ProcessWire 2.6.0 or newer. This can also serve as a starting point for building your own modules.
Everything that this module does is purely for demonstration purposes.It doesn't do anything particularly useful, but reveals a lot about what you can do with modules and hooks. Here's what it does:
Adds a hook after Page::render to output a hello world message at thebottom of editable pages (if enabled in the module configuration). Just to make it somewhat useful, clicking it takes you to the editor for that page.
Adds a hook after Pages::save to display a hello notification everytime you save a page.
$page->hello()method to all pages, which simply returns yourhello world message and information about the page. Optionally provide an argument with some text, i.e.
$page->hello('some text')to have itincluded in the return value.
$page->hello_worldproperty to all pages. Accessing it simplyreturns "Hello [your-user-name]".
Adds a ProcessPageEdit::execute hook, which displays a notification toyou only when you edit the homepage.
Install the module from your admin (Modules > Site > Hello World).
Configure the module.
After testing it, look at the code and read the comments. At this point you maywant play with it and modify it to do something useful.
To see exactly what this module does, you may want to install it as-is first.Then uninstall and follow the instructions below.
Rename the directory and all files, replacing "Helloworld" with the name of your module.
Change the class name in the module file to be [YourModuleName]. This should be the samename that you used for your module file (minus the ".module.php" part).
Modify the code of the module to do what you want. You can simply remove all of themethods in it, though you may wish to leave these method definitions in place: init() and/or ready(), ___install(), ___uninstall().
Edit the [YourModuleName].info.php file to contain info specific to your module.
If you want your module to be configurable, edit the [YourModuleName].config.phpfile, update the configuration as needed. If you do not need a configurable module, simply remove the file.
Update this README.md file to contain information specific to your module.
When you've got something you'd like to share, post your module to GitHub and tomodules.processwire.com!
Stop by the ProcessWire forums anytime and we will be gladto help with any questions.
ProcessWire Copyright 2015 by Ryan Cramer
No comments yet. Be the first to post!
Your e-mail is kept confidential and not included with your comment. Website is optional.
- Admin Helpers
- Core Modules
- Development Tools
- Field Types
- Input Fields
- Language Modules
- Language Packs
- Markup Generation
- Premium Modules
- Process Modules
- Proof of Concept
- Site Profiles
- Social, Feeds, Services
- Text Formatters
- Other Modules
- Users and Access
*Use modules at your own risk. There are no guarantees or warranties. It is recommended that you backup your site and database before installing new modules.