PacktLib: concrete5 Cookbook

concrete5 Cookbook

Credits

About the Author

About the Reviewers

www.PacktPub.com

Preface

Pages and Page Types

Introduction

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

Working with Blocks

Introduction

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

Files and File Sets

Introduction

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

Using the Core Helpers

Introduction

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

Working with Databases and Models

Introduction

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

Creating CRUD Interfaces

Introduction

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

Working with Users and Permissions

Introduction

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

Working with Themes and Add-ons

Introduction

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

System Events and Advanced Configuration

Introduction

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

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Image Gallery Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Blueprint – Creating an Events Calendar Add-on

Submitting an Add-on Package to the concrete5 Marketplace

Submitting an Add-on Package to the concrete5 Marketplace

Submitting an Add-on Package to the concrete5 Marketplace

Submitting an Add-on Package to the concrete5 Marketplace

Index