SlideShare a Scribd company logo
1 of 40
Download to read offline
ElggCamp Santiago 2011
                     Dev Edition
                         Brett Profitt
@brettprofitt • brett@elgg.org • http://el.gg/ecstgo11feedback
Who's talking?
           Hi, I'm Brett.

  Involved with Elgg since 2007.

Lead developer for Elgg since 2009.

      From Columbus, Ohio.

              #yawn.
Who am I talking to?
       Hands up!
Drop your hand if you have:

 ...contributed code to Elgg core.

     ...written an Elgg plugin.

...contributed to a PHP framework.

    ...used a PHP framework.

    ...written anything in PHP.

   ...wandered in on accident.
The Plan
        Elgg basics

       Plugin basics

Tour of 1.8 Bookmarks plugin

Plugin workshop with Emilio
Things to look for if you're a
          1.7 dev:
   Antipatterns (aka: Things not to do).

              New features.

          Deprecated features.
ASK QUESTIONS!
    Raise your hand.

       Speak out.

 @brettprofitt, @emdagon
http://elgg.org/elgg-1.8.zip
Elgg Basics
From nothing to newb in no time at all!
Elgg Blitz!
Social engine.
               Social features.

 Not limited to traditional "social networks."

More than a framework, less than a turnkey
                solution.

(More than CakePHP, less than Wordpress.)
Tech specs
Runs on LAMP (MySQL >= 5, PHP >= 5.2).

               MVC based.

   Front controller with two controllers.

     Object oriented and procedural.

     Convention and configuration.

        Modular plugins system.
Important concepts
            Data model (M).

               Views (V).

     Actions and page handlers (C).

Events and plugin hooks (extends the core
                 MVC).
Elgg application flow



        Thanks for the pic, Cash!
Model
Data model
Entities: Generic storage classes.
   ElggObject, ElggUser, ElggGroup, ElggSite.
   ElggObject <- ElggBlog, ElggPlugin, ElggWidget.

Extenders: Describe entities.
   ElggMetadata, ElggAnnotation.

Relationships - Connects entities.
   ElggUser "is_member" ElggGroup
   ElggUser "friend" ElggUser
Views
Views are easy!
              Just PHP scripts.

          Output chunks of content.

Overrideable: replace content of original view.

  Extensible: prepend or append content to
                 original view.
Working with views
             View scripts are stored in views/ dirs.

         View scripts are mapped to view name strings.

  New views use convention: put in   views/   and it Just Works™.

Extending views use configuration: elgg_extend_view($view_name,
                    $view_extension_name)
View locations
               View names are just parts of the file path!

View:
   page/elements/header_logo

Core view script:
   elgg/views/default/page/elements/header_logo.php
Overriding view locations
       Duplicate the view script directory path structure in a plugin

View:
   page/elements/header_logo

Core view script:
   elgg/views/default/page/elements/header_logo.php

Plugin override:
    elgg/mod/my_theme/views/default/page/elements/header_logo.php
Core vs Plugins
                                 Core:
elgg/
└── views/
    └── default/
        └── page/
            └── elements/
                └── header_logo.php

                                Plugin:
elgg/
└── mod/
    └── my_theme/
        └── views/
            └── default/
                └── page/
                    └── elements/
                        └── header_logo.php
Overriding view locations
                            Overriding views from other plugins.

View:
    page/elements/header_logo


Core view script:
    elgg/views/default/page/elements/header_logo.php


Plugin override:
    elgg/mod/my_theme/views/default/page/elements/header_logo.php


Another plugin override:
   elgg/mod/special_theme/views/default/page/elements/header_logo.php


Override priority is determined by plugin load priority in Advanced Plugin section.
Default?
       elgg/views/default/page/elements/header_logo.php

Views can output anything! HTML, RSS, JSON, serialized PHP.

The default dir name is the view type.

View types can be changed on any URL by appending:
   ?view=<viewtype>


RSS view type scripts live in:
  elgg/views/rss/page/elements/header_logo.php

RSS view type URLs look like:
  http://www.elggsite.org/activity?view=rss
Questions?
Controllers
Controllers are easy.
Two controllers:
  Actions: action/<action>
  Pages: <handler>/<action>

Both use configuration:
   Actions: elgg_register_action($action_name,
   $action_script)
   Pages: elgg_register_page_handler($handler_name,
   $function)


Overrideable - Just register again!
Controller locations
Actions are in actions dirs.

Pages are in pages dirs.

.htaccess + mod_write used to route to engine.
    http://elggsite.org/action/login
    -> http://elggsite.org/engine/handlers/action_handler.php?
    action=login
   http://elggsite.org/bookmarks/add
   -> http://elggsite.org/engine/handlers/page_handler.php?
   handler=bookmarks/add
Questions?
Elgg plugins
They don't have to be so ugly!
Helpful links
Code standards - http://el.gg/codestandards

Code standards checker - http://sniff.elgg.org

              Plugin guidelines -
         http://el.gg/pluginguidelines
A well-formed plugin is a happy plugin.
mod/example_plugin/
            actions/
            classes/
            languages/
            lib/
            pages/
            views/
            activate.php
            deactivate.php
            manifest.xml
            start.php
A well-formed plugin is a happy plugin.
mod/example_plugin/          <-- Dir name is the Plugin ID.
            actions/
            classes/
            languages/
            lib/
            pages/
            views/
            activate.php
            deactivate.php
            manifest.xml     <-- Describes plugin. Required.
            start.php        <-- Inits the plugin. Required.
<?xml version="1.0" encoding="UTF-8"?>
<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
    <name>Plugin Skeleton</name>
    <author>Any Person</author>
    <version>0.1</version>
    <blurb>A concise description.</blurb>
    <description>A longer, more interesting description.</description>
    <website>http://www.nowhere.org/</website>
    <copyright>(C) No one 2011</copyright>
    <license>GNU Public License version 2</license>

    <requires>
        <type>elgg_version</type>
        <version>2009030802</version>
        <comparison>gt</comparison>
    </requires>
</plugin_manifest>
elgg_register_event_handler('init', 'system', 'bookmarks_init');

function bookmarks_init() {
    elgg_register_action('bookmarks/save', "$action_path/save.php");

    [snip]
    // menus
    elgg_register_menu_item('site', $menu_options);
    elgg_register_page_handler('bookmarks', 'bookmarks_page_handler');

    elgg_extend_view('css/elgg', 'bookmarks/css');
    elgg_extend_view('js/elgg', 'bookmarks/js');

    // Register entity type for search
    elgg_register_entity_type('object', 'bookmarks');
}

function bookmarks_page_handler($page) {
    elgg_push_breadcrumb(elgg_echo('bookmarks'), 'bookmarks/all');
    elgg_push_context('bookmarks');

    $pages = dirname(__FILE__) . '/pages/bookmarks';
    switch ($page[0]) {
        case "all":
            include "$pages/all.php";
            break;

        [snip]
        default:
            return false;
    }

    elgg_pop_context();
    return true;
}
Tour of Bookmarks 1.8
        Speak up!
ElggCamp Santiago 2011
                               Dev Edition
                                      Brett Profitt
@brettprofitt • brett@elgg.org • http://el.gg/ecstgo11feedback
                                           Helpful Links
                            Elgg 1.8 Trunk - http://elgg.org/elgg-1.8.zip
                           Code standards - http://el.gg/codestandards
                          Code standards checker - http://sniff.elgg.org
                          Plugin guidelines - http://el.gg/pluginguidelines
           Live coding sample plugin - https://github.com/brettp/elgg-the-wire-attachment

More Related Content

What's hot

Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To DjangoJay Graves
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupalsparkfabrik
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Tom Brander
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Compare Infobase Limited
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOFTim Plummer
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Peter Martin
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application StructureSEONGTAEK OH
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingDougal Campbell
 
Drupal Views development
Drupal Views developmentDrupal Views development
Drupal Views developmentOSInet
 
Django Interview Questions and Answers
Django Interview Questions and AnswersDjango Interview Questions and Answers
Django Interview Questions and AnswersPython Devloper
 
Web application development with Django framework
Web application development with Django frameworkWeb application development with Django framework
Web application development with Django frameworkflapiello
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day WorkshopShyam Seshadri
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to DjangoJames Casey
 
Managing drupal views in code
Managing drupal views in codeManaging drupal views in code
Managing drupal views in codeAdolfo Nasol
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsJim Jeffers
 

What's hot (19)

Introduction To Django
Introduction To DjangoIntroduction To Django
Introduction To Django
 
Behaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & DrupalBehaviour Driven Development con Behat & Drupal
Behaviour Driven Development con Behat & Drupal
 
Django, What is it, Why is it cool?
Django, What is it, Why is it cool?Django, What is it, Why is it cool?
Django, What is it, Why is it cool?
 
Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation Zend - Installation And Sample Project Creation
Zend - Installation And Sample Project Creation
 
Introduction to building joomla! components using FOF
Introduction to building joomla! components using FOFIntroduction to building joomla! components using FOF
Introduction to building joomla! components using FOF
 
Django by rj
Django by rjDjango by rj
Django by rj
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
 
Django Framework and Application Structure
Django Framework and Application StructureDjango Framework and Application Structure
Django Framework and Application Structure
 
Jumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin ProgrammingJumping Into WordPress Plugin Programming
Jumping Into WordPress Plugin Programming
 
Drupal Views development
Drupal Views developmentDrupal Views development
Drupal Views development
 
Django Interview Questions and Answers
Django Interview Questions and AnswersDjango Interview Questions and Answers
Django Interview Questions and Answers
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
Web application development with Django framework
Web application development with Django frameworkWeb application development with Django framework
Web application development with Django framework
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
AngularJS One Day Workshop
AngularJS One Day WorkshopAngularJS One Day Workshop
AngularJS One Day Workshop
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Managing drupal views in code
Managing drupal views in codeManaging drupal views in code
Managing drupal views in code
 
Building Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in RailsBuilding Mobile Friendly APIs in Rails
Building Mobile Friendly APIs in Rails
 

Similar to ElggCamp Santiago - Dev Edition

Introduction To Eclipse RCP
Introduction To Eclipse RCPIntroduction To Eclipse RCP
Introduction To Eclipse RCPwhbath
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Phpfunkatron
 
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Joke Puts
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsAlessandro Molina
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Alessandro Molina
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks TriviaCognizant
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationArnaud Héritier
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123Parag Gajbhiye
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSmurtazahaveliwala
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python MeetupAreski Belaid
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBo-Yi Wu
 
* DJANGO - The Python Framework - Low Kian Seong, Developer
    * DJANGO - The Python Framework - Low Kian Seong, Developer    * DJANGO - The Python Framework - Low Kian Seong, Developer
* DJANGO - The Python Framework - Low Kian Seong, DeveloperLinuxmalaysia Malaysia
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep DiveGabriel Walt
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletonGeorge Nguyen
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesShabir Ahmad
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress pluginAnthony Montalbano
 

Similar to ElggCamp Santiago - Dev Edition (20)

Introduction To Eclipse RCP
Introduction To Eclipse RCPIntroduction To Eclipse RCP
Introduction To Eclipse RCP
 
React django
React djangoReact django
React django
 
Intro To Mvc Development In Php
Intro To Mvc Development In PhpIntro To Mvc Development In Php
Intro To Mvc Development In Php
 
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
Introduction to Magento 2 module development - PHP Antwerp Meetup 2017
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
TurboGears2 Pluggable Applications
TurboGears2 Pluggable ApplicationsTurboGears2 Pluggable Applications
TurboGears2 Pluggable Applications
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2
 
jQuery Tips Tricks Trivia
jQuery Tips Tricks TriviajQuery Tips Tricks Trivia
jQuery Tips Tricks Trivia
 
Apache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentationApache Maven - eXo VN office presentation
Apache Maven - eXo VN office presentation
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123
 
Fame
FameFame
Fame
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Flask Introduction - Python Meetup
Flask Introduction - Python MeetupFlask Introduction - Python Meetup
Flask Introduction - Python Meetup
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
* DJANGO - The Python Framework - Low Kian Seong, Developer
    * DJANGO - The Python Framework - Low Kian Seong, Developer    * DJANGO - The Python Framework - Low Kian Seong, Developer
* DJANGO - The Python Framework - Low Kian Seong, Developer
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Write your first WordPress plugin
Write your first WordPress pluginWrite your first WordPress plugin
Write your first WordPress plugin
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

ElggCamp Santiago - Dev Edition

  • 1. ElggCamp Santiago 2011 Dev Edition Brett Profitt @brettprofitt • brett@elgg.org • http://el.gg/ecstgo11feedback
  • 2. Who's talking? Hi, I'm Brett. Involved with Elgg since 2007. Lead developer for Elgg since 2009. From Columbus, Ohio. #yawn.
  • 3. Who am I talking to? Hands up!
  • 4. Drop your hand if you have: ...contributed code to Elgg core. ...written an Elgg plugin. ...contributed to a PHP framework. ...used a PHP framework. ...written anything in PHP. ...wandered in on accident.
  • 5. The Plan Elgg basics Plugin basics Tour of 1.8 Bookmarks plugin Plugin workshop with Emilio
  • 6. Things to look for if you're a 1.7 dev: Antipatterns (aka: Things not to do). New features. Deprecated features.
  • 7. ASK QUESTIONS! Raise your hand. Speak out. @brettprofitt, @emdagon
  • 9. Elgg Basics From nothing to newb in no time at all!
  • 11. Social engine. Social features. Not limited to traditional "social networks." More than a framework, less than a turnkey solution. (More than CakePHP, less than Wordpress.)
  • 12. Tech specs Runs on LAMP (MySQL >= 5, PHP >= 5.2). MVC based. Front controller with two controllers. Object oriented and procedural. Convention and configuration. Modular plugins system.
  • 13. Important concepts Data model (M). Views (V). Actions and page handlers (C). Events and plugin hooks (extends the core MVC).
  • 14. Elgg application flow Thanks for the pic, Cash!
  • 15. Model
  • 16. Data model Entities: Generic storage classes. ElggObject, ElggUser, ElggGroup, ElggSite. ElggObject <- ElggBlog, ElggPlugin, ElggWidget. Extenders: Describe entities. ElggMetadata, ElggAnnotation. Relationships - Connects entities. ElggUser "is_member" ElggGroup ElggUser "friend" ElggUser
  • 17. Views
  • 18. Views are easy! Just PHP scripts. Output chunks of content. Overrideable: replace content of original view. Extensible: prepend or append content to original view.
  • 19.
  • 20.
  • 21.
  • 22. Working with views View scripts are stored in views/ dirs. View scripts are mapped to view name strings. New views use convention: put in views/ and it Just Works™. Extending views use configuration: elgg_extend_view($view_name, $view_extension_name)
  • 23. View locations View names are just parts of the file path! View: page/elements/header_logo Core view script: elgg/views/default/page/elements/header_logo.php
  • 24. Overriding view locations Duplicate the view script directory path structure in a plugin View: page/elements/header_logo Core view script: elgg/views/default/page/elements/header_logo.php Plugin override: elgg/mod/my_theme/views/default/page/elements/header_logo.php
  • 25. Core vs Plugins Core: elgg/ └── views/ └── default/ └── page/ └── elements/ └── header_logo.php Plugin: elgg/ └── mod/ └── my_theme/ └── views/ └── default/ └── page/ └── elements/ └── header_logo.php
  • 26. Overriding view locations Overriding views from other plugins. View: page/elements/header_logo Core view script: elgg/views/default/page/elements/header_logo.php Plugin override: elgg/mod/my_theme/views/default/page/elements/header_logo.php Another plugin override: elgg/mod/special_theme/views/default/page/elements/header_logo.php Override priority is determined by plugin load priority in Advanced Plugin section.
  • 27. Default? elgg/views/default/page/elements/header_logo.php Views can output anything! HTML, RSS, JSON, serialized PHP. The default dir name is the view type. View types can be changed on any URL by appending: ?view=<viewtype> RSS view type scripts live in: elgg/views/rss/page/elements/header_logo.php RSS view type URLs look like: http://www.elggsite.org/activity?view=rss
  • 30. Controllers are easy. Two controllers: Actions: action/<action> Pages: <handler>/<action> Both use configuration: Actions: elgg_register_action($action_name, $action_script) Pages: elgg_register_page_handler($handler_name, $function) Overrideable - Just register again!
  • 31. Controller locations Actions are in actions dirs. Pages are in pages dirs. .htaccess + mod_write used to route to engine. http://elggsite.org/action/login -> http://elggsite.org/engine/handlers/action_handler.php? action=login http://elggsite.org/bookmarks/add -> http://elggsite.org/engine/handlers/page_handler.php? handler=bookmarks/add
  • 33. Elgg plugins They don't have to be so ugly!
  • 34. Helpful links Code standards - http://el.gg/codestandards Code standards checker - http://sniff.elgg.org Plugin guidelines - http://el.gg/pluginguidelines
  • 35. A well-formed plugin is a happy plugin. mod/example_plugin/ actions/ classes/ languages/ lib/ pages/ views/ activate.php deactivate.php manifest.xml start.php
  • 36. A well-formed plugin is a happy plugin. mod/example_plugin/ <-- Dir name is the Plugin ID. actions/ classes/ languages/ lib/ pages/ views/ activate.php deactivate.php manifest.xml <-- Describes plugin. Required. start.php <-- Inits the plugin. Required.
  • 37. <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8"> <name>Plugin Skeleton</name> <author>Any Person</author> <version>0.1</version> <blurb>A concise description.</blurb> <description>A longer, more interesting description.</description> <website>http://www.nowhere.org/</website> <copyright>(C) No one 2011</copyright> <license>GNU Public License version 2</license> <requires> <type>elgg_version</type> <version>2009030802</version> <comparison>gt</comparison> </requires> </plugin_manifest>
  • 38. elgg_register_event_handler('init', 'system', 'bookmarks_init'); function bookmarks_init() { elgg_register_action('bookmarks/save', "$action_path/save.php"); [snip] // menus elgg_register_menu_item('site', $menu_options); elgg_register_page_handler('bookmarks', 'bookmarks_page_handler'); elgg_extend_view('css/elgg', 'bookmarks/css'); elgg_extend_view('js/elgg', 'bookmarks/js'); // Register entity type for search elgg_register_entity_type('object', 'bookmarks'); } function bookmarks_page_handler($page) { elgg_push_breadcrumb(elgg_echo('bookmarks'), 'bookmarks/all'); elgg_push_context('bookmarks'); $pages = dirname(__FILE__) . '/pages/bookmarks'; switch ($page[0]) { case "all": include "$pages/all.php"; break; [snip] default: return false; } elgg_pop_context(); return true; }
  • 39. Tour of Bookmarks 1.8 Speak up!
  • 40. ElggCamp Santiago 2011 Dev Edition Brett Profitt @brettprofitt • brett@elgg.org • http://el.gg/ecstgo11feedback Helpful Links Elgg 1.8 Trunk - http://elgg.org/elgg-1.8.zip Code standards - http://el.gg/codestandards Code standards checker - http://sniff.elgg.org Plugin guidelines - http://el.gg/pluginguidelines Live coding sample plugin - https://github.com/brettp/elgg-the-wire-attachment