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

Page types in the admin


When you click on add main page in the page admin section, the pop up appears as seen here:

The Page Type in the form only holds one value at the moment, normal. We need to change this so that it can add types created by plugins.

We first assume that most pages will be "normal", so we can leave that as the single value in the select-box; we then use the RemoteSelectOptions plugin described earlier in the book to add any others if the select-box is used.

Edit /ww.admin/pages/menu.js and add the following highlighted line to the pages_new() function:

$('#newpage_date').each(convert_date_to_human_readable);
$('#newpage_dialog select[name=type]')
.remoteselectoptions({
url:'/ww.admin/pages/get_types.php'
});
return false;

And here's the /ww.admin/pages/get_types.php file:

<?php
require '../admin_libs.php';
echo '<option value="0">normal</option>';
foreach($PLUGINS as $n=>$plugin){
if(!isset($plugin['admin']['page_type']))continue;
foreach($plugin['admin'...