Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $9.99/month after trial. Cancel anytime.

MODx Web Development
MODx Web Development
MODx Web Development
Ebook522 pages2 hours

MODx Web Development

Rating: 0 out of 5 stars

()

Read preview

About this ebook

In Detail

MODx is a content management system and PHP web application framework rolled into one. With the ease of a CMS and the extensibility of a framework, MODx allows you to develop professional-looking, intricate websites with its easy-to-use interface and flexible architecture. MODx provides reusable code called snippets most of which are so generic that, without any modification, they can serve multiple functionalities. The generic nature of the snippets makes it possible to get the perfect customization that is so hard in other content management systems.

This book will get web developers up-and-running with MODx. With step-by-step examples and illustrative screenshots, you will be guided through installation, configuration, and customization. By the end of the book, you will have created a powerful, dynamic website by using the individual elements of MODx, without the need for programming know-how.

Starting with a walk-through of installing MODx, you will quickly learn how to develop your site without having to use any programming language. Logical, step-by-step instructions will show you how to create your own unique site by adding and editing documents using the inbuilt TinyMCE editor. Change the look and feel of your site by creating your own templates using HTML, CSS, and widgets. By following the example of a blog site, you will learn how to extend your templates to allow rich user interactions through comments, posts, and forms. The book teaches a few core snippets such as Ditto and Wayfinder in detail. These powerful and flexible snippets will enable you to add multiple functionalities to your site. The book will also introduce you to many more snippets which will help you build some of the commonly required web functionalities such as forums and image galleries. Manage your users with authentication and authorization and make your site user-friendly with user groups, forums, and the use of PHx notations to embed logic in templates.

Through following this easy-to-use, step-by-step guide, by the end of the book you will have a fully functional, feature-rich MODx site with professional-looking, dynamic web pages that are totally customizable.

Approach

This book is an example-driven tutorial, which will take you from the installation of MODx through to configuration, customization, and deployment. Step-by-step instructions will enable you to build a fully-functional, feature-rich website quickly and without any programming language.

Who this book is for

This book is ideal for those who want to learn to use MODx. Both beginner and experienced web developers will benefit from this comprehensive guide to MODx. No knowledge of PHP programming or any templating language is needed, but the more advanced chapters towards the end of the book will allow more confident developers to extend their applications even further by creating their own snippets.

LanguageEnglish
Release dateMar 30, 2009
ISBN9781847194916
MODx Web Development
Author

Antano Solar John

Antano Solar is a techie to the core-a tech evangelist who is passionate about using technology to revolutionize the learning experience! Antano has contributed to the open source community in terms of documentation, code, and support, with a variety of platforms based on languages such as PHP, Perl, Lisp, Python, and Ruby. He loves to share his tech excitement with fellow techies and non-techies, and does so through publishing papers, books, and delivering seminars at colleges, universities such as the IIT, and corporate tech events. He has published a paper on enhancing wireless networks in an IEEE Journal. His paper on an engine helping machines understand objectives by meta-modeling, using Neurolinguistic Programming principles and Deep Structure, is considered a landmark. An avid hacker, Antano has won two Yahoo hack-day awards. He recently won the award for developing a Hybrid Search Engine from scratch in 24 hours that uses Machine Intelligence and Social Intelligence to identify, search, and present the information in the required format. Professionally, until recently, Antano was a Consultant and a Trainer providing IT solutions and sessions on VoIP, Networks and Software Plaforms, and Languages. He is currently the Chief Technology Officer at NuVeda Learning. In his current role, he is responsible for the development and deployment of Learning Management Systems that are used by large MNCs globally. He also plays the role of a Chief Architect in the research and development of technologies related to the understanding and measuring of Learning. He is excited by the challenges of using complex technologies such as Artificial Intelligence and Natural Language Processing. Occasionally, when Antano needs to take a "Tech" break, he likes to train and tell stories!

Related to MODx Web Development

Related ebooks

Information Technology For You

View More

Related articles

Reviews for MODx Web Development

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    MODx Web Development - Antano Solar John

    (missing alt)

    Table of Contents

    MODx Web Development

    Credits

    About the Author

    About the Reviewers

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Downloading the example code for the book

    Errata

    Piracy

    Questions

    1. What is MODx?

    Content management system

    Manage content

    Content management rules

    Define content

    An application framework

    Reusable program components

    Abstracting logic from presentation

    Web development methodologies

    Old school—conventional three tiers

    Advantages of the conventional three tiers

    Disadvantages of the conventional three tiers

    Templating

    Advantages of templating

    Disadvantages of templating

    Application frameworks

    Advantages of application frameworks

    Disadvantages of application frameworks

    Content management systems

    Advantages of content management systems

    Disadvantages of content management systems

    Why MODx?

    Why a CMS?

    Why an application framework?

    So, why Modx?

    Overview of the book

    Summary

    2. Getting Started

    Setting up the development environment

    Prerequisites

    Linux

    Windows

    MAC

    Verification

    Downloading MODx

    Installing MODx

    Creating a database

    Starting the installation

    Installation status and diagnostics

    Documentation

    Official documentation

    Community-driven documentation

    Getting support

    Web forums

    IRC

    Summary

    3. MODx Basics

    Site configuration

    Configuring the site

    Default Manager interface page

    Noticing and fixing errors and warnings

    Changing the name of the site

    The basic element of MODx: Documents

    Containers

    MODx Manager interface

    Using the HTML editor

    Creating the Front Page

    QuickEdit module

    Documents revisited

    Editing documents

    Document properties

    General tab

    Page Settings

    Meta Keywords tab

    Preview tab

    Summary

    4. Templating

    Changing the template of a document

    Creating a new template and giving it a category

    HTML

    CSS

    Steps to create the new template

    Making the Home Page use the created template

    Choosing a default template

    Introducing template variables

    Modifying the template to add dynamic behavior

    Changing existing templates

    Template variables

    Creating template variables

    Template variable values

    Data source binding

    Widgets

    Creating a blog site

    Creating a document

    Post a blog entry

    Snippet and chunk basics

    Generating output

    Using a custom form for the Post a Blog ! page

    HTML for the custom blog form

    Steps to create a chunk

    Using a chunk as a form template

    Checking the Post a Blog ! page

    Rich text editor for the blog content

    Creating the template variable

    Chunk and template variable

    NewsPublisher and the Rtcontent field

    Summary

    5. Authentication and Authorization

    Create web users

    Other user properties

    Add the login snippet

    Document group for friends

    Restricting access for a document

    User group: Document group

    User: User group

    Post moderation

    Creating a role

    Creating a Manager user

    Checking the new role

    User registration

    Showing a signup form

    Joining a default group

    Link the signup form in the log in snippet

    Snippets and authorization

    NewsPublisher and authentication

    Summary

    6. Content Aggregation

    Ditto

    More flexibility with parameters

    Aggregated data in a template

    Theming MODx—chunks and placeholders

    Introducing tagging

    Creating a template variable to hold the category

    Assigning documents to a category

    XML formats

    Machine-readable formats and readers

    Readers

    Formats

    Ditto and XML formats

    Creating RSS views for each category

    Filtering

    Multiple clauses

    Extenders

    Summary

    7. Creating Lists

    Menu details in document properties

    Authentication and authorization

    Getting to know WayFinder

    Theming

    Creating a simple menu

    Nested menus

    Changing the name in the menu

    Doc Manager

    Removing pages from the menu

    More theming using chunks

    Breadcrumb navigation

    Multiple calls

    Summary

    8. Snippets

    Working of snippets

    Finding snippets

    Learning about snippets

    Jot with the minimal configuration

    Snippet parameters

    Placeholders

    Using non-bundled snippets

    Installing a snippet

    Downloading and extracting a snippet

    Adding a snippet

    Copying required files

    Using the snippet

    Snippet without dependent files

    Snippeting skills

    Summary

    9. PHx

    PHx in action

    Installing PHx

    Adding Family and Friends documents

    The PHx notation

    Simple usage

    Conditional statements

    Usage with the PHx placeholder

    Multiple conditions

    Summary

    10. Simple Recipes

    Forums

    Installing SMF

    Installing the SMF module

    Image gallery

    Emailing from forms

    User profiles

    Installing WebLoginPE

    Edit profile

    List users and view profile

    Link to edit profile

    Similar posts

    Summary

    11. Creating Snippets

    Learning to create a snippet

    Returning an output

    Returning placeholders

    Processing a chunk

    Using parameters

    MODx API

    DBAPI

    $MODx->db->select

    $MODx->db->getRecordCount

    $MODx->db->makeArray

    Fortunes

    Creating the table

    Code for fortunes

    Testing the snippet

    Chunks, placeholders, and parameters

    Using files

    Summary

    12. SEO, Deployment, and Security

    SEO

    Search engine-friendly URLs

    Meta tags and keywords

    Site map

    XHTML Strict

    Other SEO tweaks

    Using CSS to control the layout

    Content first

    Hidden text

    Descriptive text

    Tracking

    Inbound links

    Quality content

    Deployment

    Filesystem

    FTP

    SFTP

    WebDAV

    Database

    Exporting

    Importing

    Configuration file

    Configurations

    Security

    File permissions

    Installer

    Writable configuration file

    Captcha

    mod_security

    Unused files

    Manager configurations

    User tab

    File Manager tab

    Summary

    13. Plug-ins and Modules

    Plug-ins and events

    Using an existing plug-in

    Configuration

    System events

    Exploring other plug-ins

    Using custom plug-ins

    Learning about the plug-in

    Creating plug-ins

    Event-triggering snippets

    Modules

    Using modules

    Creating a module

    Executing a module

    Module's Manager interface

    Dependent plug-ins

    Learning to use custom modules

    Summary

    Index

    MODx Web Development

    Antano Solar John


    MODx Web Development

    Copyright © 2009 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: March 2009

    Production Reference: 1230309

    Published by Packt Publishing Ltd.

    32 Lincoln Road

    Olton

    Birmingham, B27 6PA, UK.

    ISBN 978-1-847194-90-9

    www.packtpub.com

    Cover Image by Nilesh Mohite (<[email protected]>)

    Credits

    Author

    Antano Solar John

    Reviewers

    Shane Sponagle

    Susan Ottwell

    Acquisition Editor

    Viraj Joshi

    Development Editors

    Sarah Cullington

    Siddharth Mangarole

    Technical Editor

    Mithun Sehgal

    Editorial Team Leader

    Abhijeet Deobhakta

    Project Coordinator

    Leena Purkait

    Indexer

    Rekha Nair

    Proofreader

    Chris Smith

    Production Coordinator

    Aparna Bhagat

    Cover Work

    Aparna Bhagat

    About the Author

    Antano Solar is a techie to the core—a tech evangelist who is passionate about using technology to revolutionize the learning experience!

    Antano has contributed to the open source community in terms of documentation, code, and support, with a variety of platforms based on languages such as PHP, Perl, Lisp, Python, and Ruby.

    He loves to share his tech excitement with fellow techies and non-techies, and does so through publishing papers, books, and delivering seminars at colleges, universities such as the IIT, and corporate tech events.

    He has published a paper on enhancing wireless networks in an IEEE Journal. His paper on an engine helping machines understand objectives by meta-modelling, using Neuro Linguistic Programming principles and Deep Structure, is considered a landmark.

    An avid hacker, Antano has won two Yahoo hack day awards. He recently won the award for developing a Hybrid Search Engine from scratch in 24 hours that uses Machine Intelligence and Social Intelligence to identify, search, and present the information in the required format.

    Professionally, Antano, until recently, has been a Consultant and a Trainer providing IT solutions and sessions on VoIP, Networks and Software Plaforms, and Languages. He is currently the Chief Technology Officer at NuVeda Learning. In his current role, he is responsible for the development and deployment of Learning Management Systems that are being used by large MNCs globally. He also plays the role of a Chief Architect in the research and development of technologies related to the understanding and measuring of Learning. He is excited by the challenges of using complex technologies such as Artificial Intelligence and Natural Language Processing.

    Occasionally, when Antano needs to take a Tech break, he likes to train and tell stories!

    To those who prepared me:

    My Mom and Dad—for all the hope, faith, love, and wise counsel.

    And to those who made it happen:

    The Packt team—especially Leena and Sarah—the reviewers, and the MODx community for an awesome open source development platform.

    About the Reviewers

    Shane Sponagle has over 10 years of experience in developing web-based applications. He is currently a senior partner at S/2M2 Design, and has worked on projects ranging from simple web sites to multi-level data-driven applications. Shane is an active member of the MODx community where he enjoys learning about all the interesting ways people are using MODx. He looks forward to collaborating on future publications.

    Susan is a self-taught grandmother of eight. She first became interested in computers, both hardware and programming, more than 40 years ago, but got her first computer only a year before the arrival of her first grandchild. She spent a number of years working both independently and as a shop technician building and repairing PCs, from Connecticut to Miami to Israel, while learning various programming and database languages from x86 assembly to dBase to VB to perl in her spare time. For a time, she taught C++ for an online gaming service's online university.

    Her PHP studies began over eight years ago, and have been conducted solely with the assets garnered from the Internet. She discovered MODx when it was still a set of modifications to Etomite, found that it suited her needs, and when MODx forked into its own CMS/CMF system, decided to stick with it, learn it thoroughly, and contribute what she could.

    Susan lives quietly, except for a very loud canary named Winston, in a Negev desert community in Israel, the home of PHP. She divides her time between hiking and photography in the desert hills and canyons, quilt making and knitting, and working with MODx on her iBook g4.

    I owe everything I've accomplished in the last 15 years to my father and my first husband for telling me I'd never be able to do it, computers weren't of any use, and it's not for girls anyway. They triggered my stubborn streak, and made me determined to do this in spite of them! Then I am indebted to the giants of teaching: Jeff Duntemann, Tom Swan, and especially Gary Cornell, for all of their wonderful books. Certain web sites have become indispensable, among them Zend, O'Reilly's OnLamp, and A List Apart. And finally, perhaps most importantly, I owe Ryan Thrash, Raymond Irving, and Jason Coward for giving me MODx to play with in the first place, and now the rest of the MODx team, whom I only know by their MODx Forum handles. They're way above my head, but they give me something to work towards.

    Preface

    This book teaches you how to use MODx for creating powerful dynamic web sites, even without the knowledge of a programming language as a prerequisite. It leads the reader step by step in a logical pattern to build a complete web site. Each chapter covers certain concepts with simple examples. All the examples if you follow along, aggregate to a self-created web site. Towards the end, it has a chapter dedicated to the serious programmers who would like to extend what they can do with MODx.

    This book can also be used as a reference or to relearn the particular concepts that have been discussed in each chapter. It has illustrative examples, wherever necessary, to make sure it is friendly. It has a mix of simple demonstrations and in-depth concepts that will interest both the casual and the serious reader.

    What this book covers

    Chapter 1: In this chapter, you will learn the general concepts of web development, and also learn why MODx as a tool is a good choice to develop your web site.

    Chapter 2: In this chapter, you will learn how to set up a working platform for developing web sites with MODx, which includes the installation and configuration of the prerequisites such as Apache, PHP, and MySQL.

    Chapter 3: In this chapter, you will learn about documents and containers, and how every page that is displayed gets its content from a document. You will also learn to create, edit, and manipulate documents, and manage their configurations, and we will explain the TinyMCE editor.

    Chapter 4: In this chapter, you will learn how to create/add templates. We will also take a look at template variables and document-specific variables, and briefly discuss snippets and chunks.

    Chapter 5: In this chapter, you will learn how to modify the site to have a signup form and login form. We will also learn how to enable blogs to be posted only by friends.

    Chapter 6: In this chapter, you will learn one very useful snippet called Ditto. You will see how to create aggregation and feeds, and how to create feeds for separate categories. You will also learn about tagging, and how to tag documents and use them in MODx.

    Chapter 7: In this chapter, you will learn how to use the snippet [[WayFinder]] to create lists of documents. We will also see the usage of parameters in WayFinder to make list creation flexible.

    Chapter 8: In this chapter, you will learn how to use the hundreds of snippets available in detail. You will also learn how to search for the snippets that don't come packaged with MODx and how to use them.

    Chapter 9: In this chapter, you will learn how to format the values in template variables. You will also learn how to make conditions based on the values of template variables, and accordingly present a different output either from the HTML in the expression or from a chunk or snippet.

    Chapter 10: In this chapter, we will use what we have already learned, to study how certain commonly required functionalities can be implemented. We will learn how to integrate a forum, an image gallery, or forms that can send a mail, create web user profiles, and identify similar posts for blogs.

    Chapter 11: In this chapter, you will learn how to create snippets, the different ways of displaying their output, and how to implement them. You will also learn to use the available MODx APIs and why you should use them.

    Chapter 12: In this chapter, we will discuss how to make the site optimized for search engines. We will also discuss clean URLs, meta tags, sitemaps, and other tweaks.

    Chapter 13: Finally, in this chapter, you will learn about plug-ins and modules including the ones that we will use in our application. The chapter will also cover events and plug-in configuration.

    What you need for this book

    No knowledge of PHP programming or any templating language is needed, but the more advanced chapters towards the end of the book will allow more confident developers to extend their applications even further by creating their own snippets.

    Who this book is for

    This book is ideal for those who want to learn to use MODx. Both beginners and experienced web developers will benefit from this comprehensive guide to MODx.

    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: "You have already seen an example of document-specific template variables when you

    Enjoying the preview?
    Page 1 of 1