10 min read

Each of these modules handles a different type of content, as is hinted at by their name, and each offers a different amount of functionality for visitors to interact with the content. We will see all of this, and also see how each module organizes the content it manages.

Content

The Content module, as the name suggests, simply handles content. The Content module is handy for adding general pieces of information to your site, which are not particularly time-sensitive or intended to generate discussion.

The ‘content’ of the Content module is called a content page, and content pages may be organized into categories. Note that these categories have nothing to do with the categories created for news stories. In fact, several of the modules in this article will organize their content into ‘categories’, and there will be no relation between the categories of one module and the categories of another module.

A content page consists of some main page text, a title, a subtitle, a header and footer, and another field, called the signature. The display of a single content page may be split easily across several web pages, with PHP-Nuke providing Next and Previous page links automatically. Content pages are ideal for holding general pieces of HTML text that need to be organized into groups or categories. Using the Content module to handle such information means that you do not have to create a new module just to display things like site policy or privacy policy documents on your site.

Content pages are not searched by the Search module.

There are no comment features or ratings available for Content content, and only the administrator may add pages; there is no place for user-submitted content here.

In versions of PHP-Nuke prior to 7.5, there was a module called Sections, which was almost identical in functionality to Content, with the addition of an image for the categories. From PHP-Nuke 7.5, the Sections module is no longer shipped with the standard installation of PHP-Nuke, and we will not consider it any further.

Like the other modules, the Content module is not activated by default, if you didn’t activate the Content module before, do so now.

Time For Action—Creating a Content Category

We are going to use the Content module to add site ‘policy’ documents, in this case a site Privacy Policy.

  1. Log in as administrator.
  2. To access the Content administration area, click on the Content link in the Administration block, or click on the Content icon in the Modules menu:

    Content Management Modules In PHP-Nuke

  3. In the Add a New Category panel, enter the text Site Documents into the Title field.
  4. Enter the following text into the Description field: Here you will find a collection of documents about the site.
  5. Click the Add button.
  6. When the page reloads, there isn’t much evidence that your category has been entered, but if you scroll down the screen to the Edit Category panel, you will find the category in the Category drop-down box:

    Content Management Modules In PHP-Nuke

What Just Happened?

We just added a content category. They are added from the Content Manager area of the administration area. The disconcerting thing is that it’s difficult to tell if your category has been added successfully; there is no list of the content categories displayed in the Content Manager area. You will have to look in the drop-down box in the Edit Category panel to confirm that your category has indeed been added.

Now we have a category, let’s add some pages.

Time For Action—Adding a Content Page

  1. In the Content Manager area of the administration area, scroll down to find the Add a New Page panel.
  2. Enter the title of the page into the Title textbox. In our case, this page will be titled Privacy Policy.
  3. Select Site Documents from the Category drop-down box.
  4. Enter the Dinosaur Portal Privacy Policy into the Sub-Title field.
  5. Next comes the Header Text. Enter the following into that field:
    This policy applies to all web sites and email services provided by the Dinosaur Portal. By using these web sites you consent to the general terms and conditions of usage and to the terms of this privacy policy.
  6. The Page Text field contains the body of the page. We’ll enter the following:

    Collection of your Personal Information


    We will ask you when we need information that personally
    identifies you (personal information) or allows us to contact
    you. Generally, we request this information when you are
    registering before ordering products from theDinosaurPortal.com,
    downloading or viewing limited-access content, entering a contest,
    ordering email newsletters. In each circumstance we try to limit
    the information we request to the minimum required to deliver the
    service to you. We also use various standard technologies such as
    cookies to track user activity on our sites.



    Use of your Personal Information


    We use your personal information for the following purposes...


  7. There are two fields remaining, Footer Text and Signature. We’ll enter this for the Footer Text:
    If you require any further assistance, please contact contact@thedinosaurportal.com

    and this for the Signature:
    the DINOSAUR PORTAL – Just because you’ve never seen one, doesn’t mean they’ve all died out…

  8. Click the Send button.
  9. When the page reloads, the details of our first page are visible in the Content Manager panel, confirming its creation:

    Content Management Modules In PHP-Nuke

  10. Now click on the Content link in the Modules block, or go straight to http://localhost/nuke/modules. php?name=Content. You will see the list of content categories:

    Content Management Modules In PHP-Nuke

  11. Click on the Site Documents link, and you will see the list of content pages in this category:

    Content Management Modules In PHP-Nuke

  12. Clicking on the Privacy Policy link will take us to our document:

    Content Management Modules In PHP-Nuke

  13. Click the Next Page link to see the rest of the document:

    Content Management Modules In PHP-Nuke

What Just Happened?

We just added a content page, and then viewed the page. We assigned the content page to the Site Documents category when we created the page. It is possible to create content pages that do not belong to any category. The current list of content pages is shown in a table in the Content Manager area; we saw this screenshot at the end of step 11.

When you visit the front page of the Content module, the list of categories is displayed. Only the categories that have content pages associated with them are displayed. Also, if there are any content pages not associated with a category, their titles will be listed here.

Clicking on a category takes you to a list of the content pages associated with that category. This list is ordered by the date on which the pages were entered; the content page created first is displayed at the top of the list and so on. For each content page, the text entered into its Title field is displayed in this list, along with the Sub-Title in brackets. Clicking on the title of a content page will take you to display of the page itself. The following diagram shows this navigation hierarchy:

Content Management Modules In PHP-Nuke

Note that there is no direct link to go back from the content page to its ‘parent’ category. You will have to use the Back button of your browser to do this. You can get back to the list of all categories by clicking the Content link in the Modules block, but you will still need to click again on the category to display the list of content pages it contains.

Returning to our privacy content page, we see that our content page has been split into two pages. This is done by inserting the text into the Page Text field, which forces PHP-Nuke to break the page at that point. The contents of the Page Text field form the body of a content page, with the Title and Sub-Title always displayed at the top.

The Next Page pager is automatically provided by PHP-Nuke, and with that you can navigate through the pages of the content page. On the first page, the Header Text is displayed before the Page Text starts, and on the final page, the Footer Text is displayed at the end of the Page Text, followed by the Signature text. A copyright notice, including the site name, follows the Signature, and then there is the date the page was created, followed by the number of times the page has been read.

Since we were still logged in as an administrator, at each part of this journey there are panels allowing you to edit the details of either the category or the content pages. For example, there is a panel for altering the category on the page displaying that category’s content pages, in addition to a ‘content page editing’ panel on each page of the content itself:

Content Management Modules In PHP-Nuke

Any of these links can be used to change the object in question. Of course, these links are visible only to an administrator. No visitor will be able to see these links or access their functionality.

Deactivating a page makes it invisible to a visitor from the list of available content pages, and the page will not be displayed even if the visitor manages to enter the URL of the content page. The administrator will be able to see a list of deactivated pages on the front page of the Content module (http://localhost/nuke/modules. php?name=Content) or in the Content Manager area of the administration area.

Currently, our Privacy Policy document is at the URL http://localhost/nuke/modules.php? name=Content&pa=showpage&pid=1. To view this page, the visitor need not go through the entire Content ‘hierarchy’ if they are provided with a direct link. We could, for example, add a link to the Privacy Policy in the footer of our page, from the Web Site Configuration menu. The link would point to the above URL, and the reader would be taken directly to our document.

The pid value of the query string is the unique identifier for this piece of content in the same way as we saw the story ID when looking at stories. This value will not change with subsequent modifications of the content page, or even moving it to another category.

The Content Block

The Content block is part of the standard PHP-Nuke installation, but isn’t loaded. You can load this block from Blocks area of the administration area by selecting Content from the Filename dropdown, and choosing a title for the block as usually done for file blocks.

Once the block is activated, it will display a list of the titles of all active content pages, with links to view each content page in full.

Note that the Content block will still display the list of titles present in the content pages even if the user does not have read access to the Content module.

Managing Categories

Categories can be edited or deleted through the Edit Category panel in the Content Manager area. Simply select a category from the drop-down box and click the Edit button to go to the Edit Category page. Here you can edit the title and description of the category, or delete the category.

Note that deleting the category does not delete the content pages associated with that category. All pages in a deleted category are preserved, but no longer belong to any category (they belong to the None category!).

Special Administrator

You can create a special administrator with rights to only the Content module in the Edit Admins menu of the Administration Menu.

Restricting Access

Access to the Content module is done on a ‘whole module’ basis. The visitor either sees nothing or everything. You cannot configure individual categories or content pages to be viewed by certain user groups.

Points and Prizes

There are no activities in the Content module that contribute any points towards a user’s point score.


Subscribe to the weekly Packt Hub newsletter

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here