Book Image

CMS Design Using PHP and jQuery

By : Kae Verens
Book Image

CMS Design Using PHP and jQuery

By: Kae Verens

Overview of this book

<p>PHP and JQuery are two of the most famous open source tools used for web development. This book will explain how to leverage their power by building a core CMS, which can be used for most projects without needing to be changed, and how to add custom plugins that can then be tailored to the individual project.<br /><br />This book walks you through the creation of a CMS core, including basic page creation and user management, followed by a plugin architecture, and example plugins. Using the methods described in this book, you will find that you can create distinctly different websites and web projects using one codebase, web design templates, and custom-written plugins for any site-specific differences. Example code and explanation is provided for the entire project.<br /><br />This book describes how to use PHP, MySQL, and jQuery to build an entire CMS from the ground up, complete with plugin architecture, user management, template-driven site design, and an installer.<br />Each chapter walks you through the problems of various aspects of CMS design and their solutions, with example code and explanation provided for the chosen solutions.</p> <p>A plugin architecture is explained and built, which allows you to enhance your own CMS by adding site-specific code that doesn't involve "hacking" the core CMS.<br />By the end of the book, you will have developed a full CMS, which can be used to create a large variety of different site designs and capabilities.</p>
Table of Contents (19 chapters)
CMS Design Using PHP and jQuery
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
11
Panels and Widgets — Part Two

Preface

PHP and jQuery are two of the most famous open source frameworks used for web development. This book will explain how to leverage their power by building a core CMS which can be used for most projects without needing to be written, and how to add custom plugins that can then be tailored to the individual project.

This book walks you through the creation of a CMS core, including basic page creation and user management, followed by a plugin architecture, and example plugins. Using the methods described in this book, you will find that you can create distinctly different websites and web projects using one codebase, web design templates, and custom-written plugins for any site-specific differences. Example code and explanation is provided for the entire project.

This book describes how to use PHP, MySQL, and jQuery to build an entire CMS from the ground up, complete with plugin architecture, user management, template-driven site design, and an installer. Each chapter walks you through the problems and solutions to various aspects of CMS design, with example code and explanation provided for the chosen solutions. A plugin architecture is explained and built, which allows you to enhance your own CMS by adding site-specific code that doesn't involve "hacking" the core CMS.

By the end of this book, you will have developed a full CMS which can be used to create a large variety of different site designs and capabilities.

What this book covers

Chapter 1, CMS Core Design, discusses how a content management system works, and the various ways to administrate it, followed by code which allows a page to be retrieved from a database based on the URL requested.

Chapter 2, User Management, expands on the CMS to build an administration area, with user authentication, and finish with a user management system, including forgotten password management, and captchas.

Chapter 3, Page Management—Part One, discusses how pages are managed in a CMS, and will build the first half of a page management system in the administration area.

Chapter 4, Page Management—Part Two, finishes off the page management system in this chapter, with code for rich-text editing, and file management.

Chapter 5, Design Templates—Part One, focuses on the front-end of the site by discussing how Smarty works. We will start building a templates engine for providing cdesign to the front-end, and a simple navigation menu.

Chapter 6, Design Templates—Part Two, improves on the navigation menu we started in the previous chapter by adding some jQuery to it, and will finish up the templating engine.

Chapter 7, Plugins, discusses how plugins work, and we will demonstrate this by building a plugin to handle page comments.

Chapter 8, Forms Plugin, improves on the plugin architecture by building a forms plugin. The improvements allow entirely new page types to be created using plugins.

Chapter 9, Image Gallery Plugin, an image gallery plugin is created, showing how to manage the uploading and management of images.

Chapter 10, Panels and Widgets—Part One, describes how panels and widgets work. These allow for extremely flexible templates to be created, where non-technical administrators can "design" their own page layouts.

Chapter 11, Panels and Widgets—Part Two, finishes up the panels system by creating a Content Snippet widget, allowing HTML sections to be placed almost anywhere on a page, and even select what pages they appear on.

Chapter 12, Building an Installer, shows how an installer can be created, using virtual machines to help test the installer.

What you need for this book

  • PHP 5.2

  • jQuery 1.4

  • jQuery-UI 1.8.

Most of the code will work exactly in Windows or Mac, but to match perfectly what I've done, I recommend using Linux. In this book, I used Fedora 13 for the creation of the CMS, and CentOS 5.2 for testing in Chapter 12, Building an Installer.

Who this book is for

If you want to see jQuery in action with PHP and MySQL code, in the context of a real application, this is the book for you. This book is written for developers who have written multiple scripts or websites, and want to know how to combine them all into one package that can be used to simplify future scripts and sites. The book is aimed at people who understand the basics of PHP and jQuery, and want to know how they can be used effectively to create a large project that is user-friendly and flexible.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: " Create a directory /ww.skins in the CMS webroot."

A block of code is set as follows:

<servlet>
<servlet-name>I18n Servlet</servlet-name>
<servlet-class>com.liferay.portal.servlet.I18nServlet</servletclass>
<load-on-startup>2</load-on-startup>
</servlet>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<portlet>
<portlet-name>104</portlet-name>
<icon>/html/icons/update_manager.png</icon>
<struts-path>update_manager</struts-path>
<control-panel-entry-category>server</control-panel-entry- category>
<control-panel-entry-weight>4.0</control-panel-entry-weight>
<control-panel-entry-class> com.liferay.portlet.admin.

Any command-line input or output is written as follows:

[root@ryuk ~]# yum install VirtualBox

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "When we click on the Users link in the menu, what we want to see is a list of the existing users".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book on, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Note

Downloading the example code for this book

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.