Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Bending and Extending PyroCMS: Add-ons and More

Bending and Extending PyroCMS: Add-ons and More

Presentation for CMS Expo on May 9th, 2012.

Avatar for adamfairholm

adamfairholm

May 02, 2012
Tweet

Other Decks in Technology

Transcript

  1. 2 • Web Developer (PHP) • CodeIgniter fan • Parse19.com

    • PyroCMS dev in charge of the streams core / Streams API Who is this?
  2. 3 • What’s PyroCMS made of? • How do I

    extend PyroCMS? • What kind of PyroCMS add-ons are available? • What tools are available for developers to use to extend PyroCMS? Questions to Answer
  3. 4

  4. CodeIgniter 6 • Strong existing developer community • Comes with

    a well-tested set of tools (codeigniter.com) • Sparks (getsparks.org)
  5. 7

  6. PyroCMS URLs 10 Type Example Custom URI Route login ->

    users/login Module URI users/logout Pages Module Page about-us/our-team 404 this-doesnt-exist [module_slug]/[function]
  7. 13 • Theme • Widget • Plugin • Module •

    Field Type • URI img css js layouts template partials template overrides
  8. 14 • Theme • Widget • Plugin • Module •

    Field Type • URI {{ widgets:instance id="1"}}
  9. 15 • Theme • Widget • Plugin • Module •

    Field Type • URI {{ uri:segments segment="1" default= "home"}}
  10. 17 • Theme • Widget • Plugin • Module •

    Field Type • URI controllers admin.php front_example.php config routes libraries helpers model plugin.php widgets
  11. 18 • Theme • Widget • Plugin • Module •

    Field Type • URI Form display Save/Process data logic css js img AJAX URIs
  12. 19 • Theme • Widget • Plugin • Module •

    Field Type • URI PyroCMS Pages Built with the page tree and {{ tags }}
  13. 20 • Theme • Widget • Plugin • Module •

    Field Type • URI Built with the page tree and {{ tags }} PyroCMS URLs Preset URIs that come with PyroCMS & modules. You can build your own as well.
  14. PyroBackup 23 • Simple module to back up your site

    database • File system, Amazon S3, or via email • Easy cron job setup • Create backup profiles
  15. Social Integration 25 • Easily integrate PyroCMS with social login

    systems • Integrates with PyroCMS’s blog to post new entries to Facebook or Twitter
  16. PyroStreams 30 • Structure, manage, and display data • Uses

    streams+fields structure • Includes relationships, multiple relationships, grids, and more.
  17. PyroStreams 31 • Display data in loops, single forms, calendars,

    entry forms, and more • Maps directly to database structure in MySQL
  18. 33 • PyroCMS is built to be developer-friendly • Beginning

    developers can cleanly integrate custom functionality • Advanced developers can built complex applications PyroCMS and Developers
  19. 36 Fun with Plugins <?php class Plugin_sample { public function

    custom_format() { // Get data between tags $data = $this->content(); $param = $this->attribute(‘parameter’, ‘default’); // Manipulate & return it return strip_tags($data, ‘<p>’); }
  20. 37 {{ sample:loop_example }} <p>{{ count }}. {{ title }}</p>

    {{ /sample:loop_example }} Fun with Plugins
  21. 38 Fun with Plugins <?php class Plugin_sample { public function

    loop_example() { $vars = array( array(‘count’ => 1, ‘title’ => ‘First’), array(‘count’ => 1, ‘title’ => ‘Second’), ); return $vars; } }
  22. 39 • CRUD no more! • Build up/tear down •

    Single-line functions to set up common control panel pages and functionality • Namespaces PyroStreams API
  23. 40 PyroStreams API // Create a stream $this->streams->streams->add(‘Applications’, ‘apps’, ‘grants_app’);

    // Add a field $field = array( ‘name’ => ‘Application Title’, ‘slug’ => ‘app_title’, ‘type’ => ‘text’, ‘assign’ => ‘apps’, ‘required’ => true ); $this->streams->fields->add_field($field);
  24. 41 PyroStreams API // Display a page of entries $this->streams->cp->entries_table(

    ‘apps’, ‘grants_app’, 25, // Entries to show per page ‘admin/grant/apps’, array(‘buttons’ => {custom buttons per entry})); // Tear down a namespace $this->streams->utilities- >remove_namespace(‘grants_app’);
  25. 42 Template Library // Extend core classes to create admin

    or public pages: class My_section extends Public_Controller class My_section extends Admin_Controller // Build entire PyroCMS site page with active theme $this->template->build(‘my_page_view’); // Pass a variable to the template view $this->template->set(‘var’, $var);
  26. 43 • Upload and mange folders/files on local or on

    cloud storage Files Module // Create a folder Files::create_folder($parent, $name, $location, $remote_container); // Upload a file to a folder Files::upload($folder_id, $file_name);
  27. 44 • Simple & Effective Cache Library • Events •

    Control Panel GUI Tools • Assets minification Other Tools