Developer

SolutionBase: Build a quick and inexpensive content management system with phpWebSite

Managing content on a web site can be complicated and expensive. Fortunately, you can solve both of these problems using the open source tool called phpWebSite. Jack Wallen shows how it works.

This article is also available as a TechRepublic download.

I've been creating and running content management sites (at various levels and sizes) for nearly a decade now. I've rolled out sites with many different tools from Adaptive Website Framework to Zope. Every tool seems to have its pluses and minuses (with most leaning toward the minuses.) But about five years ago I happened upon a tool that made the rollout/creation/management job elegant and easy. This tool is called phpWebSite.

What's phpWebSite?

What does phpWebSite offer? How does this list grab you:

  • Easy, Web-based administration with minimal computer experience needed to maintain site content.
  • Flexible layout control - site page layout can be changed at anytime.
  • Topic-based announcements - organize site announcements by category with automatic history rollover.
  • Interactive content - visitors can post comments, submit announcements and Web links.
  • Full featured event calendar - post events by category and subcategory in a flexible cross-referenced calendar.
  • Customized user experience - themes allow each visitor to customize the Web site for his or her preferences or special needs.
  • XHTML and WAI compliance.

And not only is phpWebSite easy to install and manage, it's a snap for end users to navigate and use. All in all, the perfect match for a company looking to roll out fast, dynamic, reliable content sites. All that being said, let's look under the hood a bit.

What do I need and where do I get it?

The phpWebSite tool was born and raised at the Appalachian State University by the Web Technology Group and created by a development team from around the world. phpWebSite is fully GNU GPL/LGPL compliant is valid XHTML 1.0 and meets the W3C's Web Accessibility Initiative requirements. The system is based, obviously, around PHP and has the following requirements:

  • PHP v4.2.2 or greater
  • PEAR base packages
  • MySQL database
  • The ability to modify directory permissions
  • Shell access for the initial installation process

The very first thing you'll need to do (after you've made sure your server meets the requirements of course) is to download the necessary file (You'll want more than one file but for the base installation, you'll only nab one.). Download the core file from SourceForge.

Installing phpWebSite

After you download the file, move it to your root directory of your Web server (If you are using Fedora Core that directory will be /var/www/html/.) Once you've moved the file change to that same directory and run the following command:

tar xvzf phpWebsite-0.10.2-full.tar.gz

Now you'll have a new directory called phpWebsite-0.10.2-full. You are going to want to change the name of this directory now or you'll wind up having to redo the entire install when your employees start complaining they don't want to type http://www.companydomain.com/phpWebsite-0.10.2-full every time they need to visit. To do so run this command:

mv phpWebsite-0.10.2-full main

(where main is the name of the subdirectory the Website will live in.)

With the directory renamed, you're ready to move on. Change into the newly named directory where you'll see more directories and files. The very first thing you will want to do is to change to the setup directory and run the command (as root):

./secure_phpws.sh setup

The next step isn't well documented but, from my experience, crucial. Go back one directory (with the command cd ../) and then change into the core directory. Within that directory you'll see the Core.php file. Open that file up with your favorite text editor and find the line:

//ini_set('memory_limit', '16M');

Change the 16 to 64 (or higher) so you dedicate more than enough memory for the system. What I have experienced is with the minimal memory allocation in the Core.php configuration, if you install more than the skeleton system, the installation is completely hosed and you have to start all over.

Now that you've allocated enough memory for your system, it's time to create a database for your system (I will assume you know how to setup the database.) and then fire up your browser and begin the bulk of the install.

The address to set up is simple. We'll assume you've used the main name for your subdirectory. That in mind you'll hop on over to:

http://www.companydomain.com/main/

(where companydomain.com is your actual domain or IP address) . You'll now see a fully-Web based setup for your system. Most of the configuration variables to enter are self explanatory. The only variable that might trip you up is the Table Prefix. This is only used if you have multiple sites indexing one single table (or database).

Once you've completed this configuration click Create Config File. If you do not get any errors you can then continue by clicking on the "Click here..." link. If you get errors you might have to manually change the permissions of the subdirectory by changing back to the /var/www/html directory and issuing the command:

chmod -R 777 main

to give complete access to the files and directories. This, of course, is unsafe but will allow you to complete the installation (We'll fix that in a moment.) The new window will ask you for the password you configured in the initial setup screen. Enter that password and click Continue. The next screen will require you to configure an administrator. Do so and click Continue.

The next screen is where you choose what modules to install. Because of previous frustrating experiences, I am going to tell you to scroll down and select only the Install Core Only button. This will install the bare minimum needed to get the system up and running. We'll add more modules in a moment.

The installation will check the modules and install the correct files until the core is complete. When this is finished there will be a link at the bottom labeled "Go to my installation." Click that and you'll be greeted by your new Content Management System. However, all you will see is a logo and a login window. No problem. Log in with the admin username/password you configured and you'll see a new window which includes the link to the Control Panel. The Control Panel is your best friend within the world of phpWebsite. Click on that to reveal three new tabs: My Settings, Site Content, and Administration. Click on the Administration tab and then the Boost link.

Installing modules

Boost is where will you do all of the installing of new modules. Obviously, in your new installation, you only have the core installed. Scroll down to the Other Modules section and, one by one, install the following (for a basic-use content management system):

  • Announcements
  • Calendar
  • Comment Manager
  • Documents
  • FAQ
  • Menu Manager
  • Web Pages
  • Form Generator
  • Photo Albums
  • Bulletin Board

NOTE: After each module installation, click on the Go Back link to continue installing new modules.

With all of the above modules installed, you now have a fairly robust system to use.

Basic configurations

One of the first configuration tools you'll want to get to know is the Layout Admin tool. Go back to the Control Panel and click on the Administration tab. Under this tab you'll see the Layout Admin link. This tool will allow you a good number of key configurations. The Layout Admin tool actually opens a new panel at the top of the page that will remain open until you close it. This is a good thing because one of the features of this tool is the ability to turn on and off the Move Boxes handles. The Move Boxes handles allow you to easily configure where you want every box to live on your site. Very handy for those who are particular about how a site is navigated and viewed.

But before you start moving boxes around, the key configurations you'll want to deal with are:

  • Change Page Title
  • Edit Metatags
  • User Can Change Theme

The first two configurations are self-explanatory. For the metatags, make sure you go through the configuration of all the entries in the drop-down list. The User Can Change Theme configuration will allow your users to change the look of their experience. This is limited to the themes you have installed on your system. Use caution with this. If you allow the users to change the theme of the Website, you'll want to make sure each theme is actually tailored to your companies needs. Otherwise you'll have one theme edited to match your companies color scheme/logo and the rest of the themes will be generic phpWebsite themes (not terribly professional).

If you turn the Move Boxes buttons on you will see various arrows pointing up, down, left, and right. This can be confusing until you remember one key point: Top Left/Bottom Right for each box. What that means is the arrows in the top left corner and bottom right corner are used for one box. So the top box (which with the Layout panel on) would be the Layout panel so the top left arrows and bottom right arrows around the Layout panel belong to that box. To move the layout panel down one box click the down arrow on the down right corner of the Layout panel. When you're finished with the Layout panel, click the Close Panel button.

Design

Touching up your CMS graphically is only as challenging as is your graphics ability. The key to altering the graphics of your site is the themes. Remember, you only installed the basic system. From the download site you can grab the Theme Pack which will need to be moved to /var/www/html/main/themes. Once moved run the command:

tar xvzf /var/www/html/main/themes/phpWebsite-current-themes.tar.gz

which will unpack all the swell themes into the proper directory. Now that these themes are installed go back to the Layout Admin tool and click on the Set Default Theme drop down.

You should see a long list of themes available. Check out each of those themes and decide which them best suits your needs.

Of course once you've decided upon a pre-created theme, you'll have to alter that theme for your company. This isn't as difficult as it seems. Within the /var/www/html/main/themes directory you'll see a subdirectory for each theme. Check out the contents of the theme you've chosen and you'll see (depending upon your theme) an images and/or img directory. One tiny issue with phpWebSite is the standardization of the themes is not complete. Some themes use different names and formats for banners/logos and even some directory structure. A deeper understanding of the configuration of the themes will come at a later date. But by poking around the files/filesystem, you'll get a good idea how it's done.

Final words

phpWebSite is, by far, my favorite Content Management System available. Not only is its price attractive (free), it's flexibility, reliability, and stability make it the perfect solution for companies of any size and any need. Get your phpWebSite system up and running. Soon we'll revisit the topic and dive deeper into its use, configuration, and customization.

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox