Diving In: Practical Tips for Custom Plugin Development

Eb03b5297a9878512caf92637bdabd26?s=47 Blake Walters
October 16, 2012

Diving In: Practical Tips for Custom Plugin Development

Eb03b5297a9878512caf92637bdabd26?s=128

Blake Walters

October 16, 2012
Tweet

Transcript

  1. by Blake Walters at EECI, Austin, TX on October ,

     DIVING IN: PRACTICAL TIPS FOR WRITING CUSTOM PLUGINS
  2. EECI HELPED CHANGE HOW I BUILD SITES

  3. ‎ New development workflow ‎ Always up-to-date base install ‎

    The template partials approach ‎ Custom add-on development
  4. ‎ New development workflow ‎ Always up-to-date base install ‎

    The template partials approach ‎ Custom add-on development
  5. ‎ New development workflow ‎ Always up-to-date base install ‎

    The template partials approach ‎ Custom add-on development
  6. ‎ New development workflow ‎ Always up-to-date base install ‎

    The template partials approach ‎ Custom add-on development
  7. expressionengine.com/user_guide/ CREDITS

  8. devot-ee.com CREDITS

  9. google.com CREDITS

  10. ExpressionEngine Control Panel CREDITS

  11. ExpressionEngine Control Panel CREDITS

  12. None
  13. ‎ It’s notoriously slow [1] ‎ It’s not “user” friendly

    ‎ It’s not at all portable ‎ It locks you into a single parsing stage ‎ It gives you the “I’ll just enable PHP” mindset WHY NOT IN-TEMPLATE PHP? [1] http://www.gregaker.net/2010/oct/28/with-great-power-comes-great-responsibility/
  14. ‎ It’s notoriously slow ‎ It’s not “user” friendly ‎

    It’s not at all portable ‎ It locks you into a single parsing stage ‎ It gives you the “I’ll just enable PHP” mindset WHY NOT IN-TEMPLATE PHP?
  15. None
  16. ‎ It’s notoriously slow ‎ It’s not “user” friendly ‎

    It’s not at all portable ‎ It locks you into a single parsing stage ‎ It gives you the “I’ll just enable PHP” mindset WHY NOT IN-TEMPLATE PHP?
  17. ‎ It’s notoriously slow ‎ It’s not “user” friendly ‎

    It’s not at all portable ‎ It locks you into a single parsing stage ‎ It gives you the “I’ll just enable PHP” mindset WHY NOT IN-TEMPLATE PHP?
  18. PHP on Input PHP on Output EE Template Tags

  19. None
  20. ‎ It’s notoriously slow ‎ It’s not “user” friendly ‎

    It’s not at all portable ‎ It locks you into a single parsing stage ‎ It gives you the “I’ll just enable PHP” mindset WHY NOT IN-TEMPLATE PHP?
  21. HOW ABOUT BUILDING A CUSTOM PLUGIN?

  22. ‎ Flexibility ‎ Readability ‎ Portability ‎ Performance WHY A

    CUSTOM PLUGIN
  23. ‎ Flexibility ‎ Readability ‎ Portability ‎ Performance WHY A

    CUSTOM PLUGIN
  24. ‎ Flexibility ‎ Readability ‎ Portability ‎ Performance WHY A

    CUSTOM PLUGIN
  25. ‎ Flexibility ‎ Readability ‎ Portability ‎ Performance WHY A

    CUSTOM PLUGIN
  26. GREAT, BUT WHAT CAN YOU DO WITH IT?

  27. Duke Admissions CREDITS

  28. Kettler Property Management CREDITS

  29. Rumble Games CREDITS

  30.   GETTING STARTED

  31. BREAKING DOWN THE TEMPLATE TAG

  32. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  33. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  34. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  35. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  36. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  37. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  38. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  39. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about plugins {/exp:eeci:present}

  40. {exp:eeci:present style=”keynote” parse=”inward”} Just a little presentation about {presentation_title} {/exp:eeci:present}

  41. {exp:ce_img:pair src=”{your_custom_field}”} <img src=”{made}” width=”{width}” height=”{height}”/> {/exp:ce_img:pair}

  42.   GETTING IT WRITTEN

  43. expressionengine.com/user_guide/development/ CREDITS

  44. expressionengine.com/user_guide/development/plugins.html CREDITS

  45. http://expressionengine.com/user_guide/development/guidelines/general.html CREDITS

  46. pkg.io CREDITS

  47. None
  48. None
  49. None
  50. None
  51. None
  52. THE SIMPLEST OF PLUGINS

  53. {exp:eeci_demo}

  54. None
  55. None
  56. PLUGIN METHODS

  57. {exp:eeci_demo:say} {exp:eeci_demo:shout}

  58. None
  59. None
  60. PASSING PARAMETERS

  61. {exp:eeci_demo:say message="Parameters are fun!"}

  62. None
  63. None
  64. TAG PAIRS

  65. {exp:eeci_demo:shout} Tag pairs aren't bad either {/exp:eeci_demo:shout}

  66. None
  67. None
  68. COMPLEX OUTPUT

  69. {exp:eeci_demo:feed_info} <h1>{title}</h1> <p> {publish_date} </p> {content} {/exp:eeci_demo:feed_info}

  70. None
  71. None
  72. None
  73. None
  74. {exp:eeci_demo:feed_info} <h1>{title}</h1> <ul> {authors} <li>{name}</li> {/authors} </ul> <p> {publish_date} </p>

    {content} {/exp:eeci_demo:feed_info}
  75. None
  76. None
  77. {exp:eeci_demo:feed_info} <ul> {authors} <li> <p>{name} </p> <p> {tags} {tagname} {/tags}

    </p> </li> {/authors} </ul> {/exp:eeci_demo:feed_info}
  78. {exp:eeci_demo:feed_info} <ul> {authors} <li> <p>{name} </p> <p> {tags} {tagname} {/tags}

    </p> </li> {/authors} </ul> {/exp:eeci_demo:feed_info}
  79. FIXING THE PARSE ORDER

  80. None
  81. None
  82. None
  83. {exp:eeci_demo:feed_info} {count} {total_results} {switch=”one|two|three”} {/exp:eeci_demo:feed_info}

  84. Questions so far?

  85.   STEPPING UP YOUR GAME

  86. ‎ Project Specific ‎ Abstracted and Stand-Alone PLUGIN ORGANIZATION

  87. ‎ Project Specific ‎ Abstracted and Stand-Alone PLUGIN ORGANIZATION

  88. BUILT-IN EE CLASSES

  89. None
  90. None
  91. None
  92. None
  93. None
  94. None
  95. exp_channels exp_channel_titles exp_channel_data exp_categories exp_category_posts exp_relationships (exp_playa_relationships)

  96. None
  97. None
  98. ‎ CP ‎ Email ‎ File Field ‎ Form Validation

    ‎ Input ‎ Language ‎ Layout A WHOLE BUNCH MORE ‎ Localization ‎ Logger ‎ Security ‎ Table ‎ Typography ‎ URI ‎ XML Parser
  99. TAPPING INTO OTHER ADD-ONS

  100. None
  101. Duke Admissions CREDITS

  102. None
  103. THE CI IN EECI

  104. THE CI IN EECI

  105. ‎ Benchmarking ‎ Calendar ‎ Encryption ‎ Image Manipulation ‎

    XML-RPC ‎ Zip Encoding ‎ tons more... CODEIGNITER LIBRARIES/CLASSES
  106. None
  107. {if “{exp:eeci_demo:is_mobile}” == "true"} You're on a mobile device. {if:else}

    No mobile for you! {/i }
  108. None
  109. ‎ Array ‎ Cookie ‎ Date ‎ Number ‎ Path

    ‎ URL ‎ tons more... CODEIGNITER HELPERS
  110. None
  111. {exp:eeci_demo:inflector text="dogs" method="singluar"} {exp:eeci_demo:inflector text="cat" method="plural"} {exp:eeci_demo:inflector text="maybe something to

    camel case" method="camel"} {exp:eeci_demo:inflector text="Combine to a single word" method="underscore"} {exp:eeci_demo:inflector text="maybe_a_url_title" method="human"}
  112. None
  113. codeigniter.com/user_guide/ CREDITS

  114. WHERE TO NOW?

  115. Thanks! @markupboy blake@markupboy.com markupboy.com