Add new custom module in PHP-Nuke

In this article I’m going to teach you how to add a new custom module to your PHP-Nuke website.

In PHP-Nuke, modules are used in order to build up the menu items of your site. You could create for example a module that has some simple text content and a link to a remote website. Visitors to your site would be able to get to this page by clicking on the module’s link in your Modules menu.

Creating a new module in PHP-Nuke

Following the steps below I’ll walk you through creating a new custom module called Support, that simply has some text and then a link back to our support center.

  1. Login to your cPanel
  2. Under the Files section, click on File Manager, select Web Root and click on Go.
  3. Navigate to the directory you’ve installed PHP-Nuke to, then go into the modules directory.
  4. In the top menu, click on + New Folder, then name the folder what you’d like to name your module. In this case I’ve named mine Support, then click on Create New Folder.
  5. Now click on the newly created Support modules folder.
  6. Next click on + New File, name your new file index.php, then click on Create New File.
  7. Now right-click on the newly created index.php script, and select Edit.
  8. This is the example code I have used for my module:

    <?php
    if (!eregi(“modules.php”, $PHP_SELF)) {
    die (“You can’t access this file directly…”);
    }
    $index = 1;
    require_once(“mainfile.php”);
    $module_name = basename(dirname(__FILE__));
    get_lang($module_name);
    include(“header.php”);

    echo “<p>This is a test module!</p>”;

    echo ‘<a href=”https://www.inmotionhosting.com/support”>InMotion Support Center</a>’;

    include(“footer.php”);
    ?>

  9. Now click on Save Changes up at the top-right.

Activating newly created module in PHP-Nuke

Now that you’ve created a new module, we need to login to PHP-Nuke to set it to active. Follow along with these steps to accomplish that.

  1. Login to your PHP-Nuke admin dashboard.
  2. In the 2nd row, 4 icons over, click on Modules.
  3. Scroll down till you see the newly created Support module, and click on the cog icon to the far-right of it to enable the module.
  4. Now if you navigate back to your PHP-Nuke main page, you should see under the Modules menu the new Support one, and clicking on it will take you to the page that includes our text and link!

You should now understand the very basics of creating a new custom module to use with PHP-Nuke.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+