Free Sample
+ Collection

concrete5 Cookbook

David Strack

Over 140 recipes to help you develop websites using the concrete5 content management system
RRP $26.99
RRP $44.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782164548
Paperback296 pages

About This Book

  • Recipes for developing websites with concrete5, a popular open source content management system
  • A useful guide for concrete5 novices and experts alike
  • Contains blueprints of selected projects explained extensively with a top-to-bottom approach

Who This Book Is For

This book is geared towards intermediate to advanced PHP developers who would like to learn more about the concrete5 content management system. Developers already familiar with concrete5 will learn new time-saving tricks and will find the book to be a great reference tool.

Table of Contents

Chapter 1: Pages and Page Types
Create a custom debugging function
Getting the current Page object
Getting a Page object by its ID
Getting a Page object by its path
Getting a page type by its ID
Getting a page type by its handle
Getting a page type's ID
Getting a page type's name
Getting a page type's handle
Getting the icon for a page type
Getting a list of pages that belong to a page type
Creating a page type
Updating a page type
Deleting a page type
Creating a page type
Updating an existing page
Setting page attributes
Getting a page attribute
Getting a page's ID
Getting a page's path
Getting a page's handle
Getting a page's name
Getting a page's description
Getting a page's page type ID
Getting a page's page type handle
Getting a page's theme object
Getting the children below a page
Moving a page
Deleting a page (and its children)
Getting a list of pages
Adding a page selector field to a form
Chapter 2: Working with Blocks
Creating a custom block type
Using block controller callback functions
Sending variables from the controller to the view
Adding items to the page header and footer from the block controller
Creating custom block templates
Including JavaScript in block forms
Including JavaScript in the block view
Including CSS in the block view
Loading a block type by its handle
Adding a block to a page
Getting the blocks from an area
Chapter 3: Files and File Sets
Loading a file by its ID
Getting a file's path
Getting a list of files
Uploading a file to the file manager
Loading a file set by its ID
Adding a file to a file set
Removing a file from a file set
Checking if a file is part of a file set
Getting all of the files in a file set
Duplicating a file
Deleting a file
Reindexing a file's search attributes
Setting passwords on file objects
Setting permissions on files
Getting the download URL for a file
Getting the download statistics for a file
Adding a file picker to a form
Chapter 4: Using the Core Helpers
Loading a helper class
Using the Date helper
Using the Encryption helper
Loading an RSS feed with the Feed helper
Managing files and directories with the File helper
Creating custom forms with the Form helper
Including a WYSIWYG editor on a form
Generating HTML code with the HTML helper
Generating and caching thumbnails with the Image helper
Encoding and decoding JSON with the JSON helper
Sending e-mails with the Mail helper
Determining the MIME type of a file extension using the MIME helper
Getting page URLs and breadcrumbs with the Navigation helper
Working with strings using the Text helper
Generating URLs with the URL helper
Validating input data using the Validation helpers
Preventing spam using the Captcha helper
Getting a list of countries
Getting a list of states and provinces
Showing a color picker on a form
Showing a date/time selector on a form
Showing a rating widget on a form
Using the banned words list
Reading and writing to the system cache
Writing to the debug log
Reading and writing to the configuration registry
Chapter 5: Working with Databases and Models
Loading the database object
Retrieving data from the database
Writing data to the database
Guarding against SQL injections using prepared statements
Creating a custom model class
Reading from the database with active record
Writing to the database with active record
Updating a database record with active record
Searching the database using active record
Deleting objects using active record and model classes
Defining relationships with active record
Chapter 6: Creating CRUD Interfaces
Creating controller files for single pages on the dashboard
Creating view files for single pages on the dashboard
Adding single pages to the dashboard
Creating a form to create items
Saving data to the database from a controller
Creating a view to display a list of database items
Adding editing capabilities to create a form
Creating a delete action
Chapter 7: Working with Users and Permissions
Checking if the current user is logged in
Getting the currently logged-in user
Loading a user by its ID
Loading a user by its username
Getting a user's info
Setting a user's attributes
Retrieving a user's attributes
Loading a group by its ID
Loading a group by its name
Adding a user to a group
Getting all of the users from a group
Checking if a user is a member of a group
Removing a user from a group
Logging out a user
Deleting a user
Getting the permission object
Checking if a user can read a page
Checking if a user can edit a page
Checking a user's file permissions
Chapter 8: Working with Themes and Add-ons
Creating a custom theme
Including the concrete5 required scripts and styles
Defining editable content areas
Creating page type templates
Using elements for repeated portions of HTML
Customizing system pages
Creating a custom add-on package
Using the package controller to execute custom code
Chapter 9: System Events and Advanced Configuration
Declaring advanced configuration variables
Enabling events in concrete5
Listening to system events
Passing parameters to event handlers
Defining a page type event
Sending an e-mail when a user creates an account
Sending an e-mail when a file has been uploaded
Creating a custom scheduled job
Making your add-on translation ready
Rebranding concrete5 as a white label CMS
Changing the dashboard background image

What You Will Learn

  • Manage pages and the sitemap
  • Connect to and query the database
  • Code real data models with Active Record
  • Produce custom dashboard interfaces
  • Make a custom theme
  • Hooke into system events
  • Create an image gallery add-on
  • Sell add-ons in the concrete5 marketplace and earn money

In Detail

concrete5 is an increasingly popular open source content management system because of its incredible and easy-to-use interface. But, it also comes complete with a robust PHP framework, allowing web developers to create custom websites and applications with ease.

"concrete5 Cookbook" is a practical collection of solutions to tasks that both novice and experienced concrete5 developers face on a regular basis. Readers will learn multiple subjects, including full blueprints for developing an event calendar add-on and an image gallery block. Developers new to concrete5 will quickly learn how to customize concrete5 to their needs, and seasoned pros will find it an excellent quick reference for performing specific tasks.

"concrete5 Cookbook" will transform ordinary PHP developers into concrete5 experts capable of bending concrete5 to their will and unleashing the true power of this up-and-coming content management system. Throughout the course of over 140 recipes and 3 bonus project blueprint chapters, PHP developers will learn how to create custom blocks and dashboard interfaces as well as programmatically work with pages, files, users, permissions, and more. Discover the built-in Active Record support that makes working with databases simple and maintainable. Readers will also learn how to take advantage of the numerous helper classes included in concrete5, and will dive deep into the concrete5 MVC framework to create powerful custom websites and applications. Tie together all of the concepts learned in the recipes with 3 bonus chapters featuring complete blueprints to create a calendar add-on, an image gallery block type, and tips on how to sell your themes and add-ons for money!

"concrete5 Cookbook" is a complete collection of recipes to solve the most common (and some not-so-common) tasks that concrete5 developers will face on a regular basis.


Read More