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

Iain Urquhart - #eeciconf

Iain Urquhart - #eeciconf

Edging your way into #EECMS development.
When you’re a designer.



May 30, 2012


  1. Edging your way into #EECMS development. When you’re a designer.

    @iain | #EECI2012 EU Wednesday, 30 May 12
  2. Hai. @iain | #EECI2012 EU I’m @iain 1998 - Art

    School 2003 - Graphic & Web Design 2006 - ExpressionEngine 2009 - First Add-ons I fly solo most of the time, handling design, development and account management for my projects. Maintain a handful of add-ons which are by-products of my work. Wednesday, 30 May 12
  3. Assumption. By Development I mean extending #EECMS @iain | #EECI2012

    EU Getting EE do do stuff it doesn’t do ‘out of the box’ Wednesday, 30 May 12
  4. Why start learning EE dev? When is the right time?

    Personal experience: dev fundamentals that I really struggled with What resources helped me (and didn’t help me) get me started with development Areas of CodeIgniter docs to bookmark when starting out How to get help Managing client expectations Working within your bounds General tips, open discussion What I’m going to talk about: @iain | #EECI2012 EU Wednesday, 30 May 12
  5. Why bother? @iain | #EECI2012 EU Surely what you need

    is out there already? Yeah nah yeah. The projects you’re getting are getting bigger & more complex That awesome template (using first party tags/modules even) is generating 489 queries and taking 3 seconds to render. Things like LESS are crossing over into programming Good developers are always busy, pull some tasks over You want to learn Wednesday, 30 May 12
  6. Designer to hybrid developer. The stages of evolution. @iain |

    #EECI2012 EU Wednesday, 30 May 12
  7. 1.0 Awestruck Development is magic performed by gods. @iain |

    #EECI2012 EU Wednesday, 30 May 12
  8. 2.0 Fumbling Idiot Coding by copy paste. @iain | #EECI2012

    EU Wednesday, 30 May 12
  9. 3.0 Explorer A whole new world has opened up. @iain

    | #EECI2012 EU Wednesday, 30 May 12
  10. 4.0 Delusional Intoxicated by new power. @iain | #EECI2012 EU

    Wednesday, 30 May 12
  11. 5.0 Pragmatic Tools in your belt, experience to call upon.

    You realise how much you don’t know. @iain | #EECI2012 EU Wednesday, 30 May 12
  12. Be Realistic. You’re not moving to a new career, you’re

    adding to your existing toolbelt. Some things are simply outside your reach. @iain | #EECI2012 EU Wednesday, 30 May 12
  13. @iain | #EECI2012 EU Set some goals. Get to where

    you want to be. Wednesday, 30 May 12
  14. My Goals I set out to: @iain | #EECI2012 EU

    Get some basic PHP skills Build some really simple, niche plugins Build a control panel module interface, with multiple views/methods Get data in and out of a database without using EE tags Be able to pinpoint problems (not necessarily solve them) Communicate my problems efficiently to outsource solutions Be less dependant on the EE dev team and take action myself for what I thought were the weak parts of EE Wednesday, 30 May 12
  15. Fundamentals that make you go mental. @iain | #EECI2012 EU

    Wednesday, 30 May 12
  16. @iain | #EECI2012 EU Understanding the docs. Wednesday, 30 May

  17. @iain | #EECI2012 EU Wednesday, 30 May 12

  18. @iain | #EECI2012 EU Methods& Parameters & What the...? Wednesday,

    30 May 12
  19. {exp:channel:entries          limit="1"        dynamic="off"

           disable="custom|fields" } Think of a channel entries tag; We have a method, and we’re passing some parameters. @iain | #EECI2012 EU Wednesday, 30 May 12
  20. @iain | #EECI2012 EU Lets take a simple PHP function:

    http:/ /php.net/str_replace Wednesday, 30 May 12
  21. {exp:str_replace          search="Ellis  Labs"      

     replace="EllisLab"        subject="OH  HAI  Ellis  Labs" } Here is our function/method with it’s available parameters echo  str_replace(              "Ellis  Labs",              "EllisLab",              "OH  HAI  Ellis  Labs" ); @iain | #EECI2012 EU Wednesday, 30 May 12
  22. Here is our function/method with it’s available parameters http:/ /expressionengine.com/user_guide/development/reference/functions.html

    $this-­‐>EE-­‐>functions-­‐>word_limiter($my_words,  20); @iain | #EECI2012 EU Wednesday, 30 May 12
  23. @iain | #EECI2012 EU Arrays. They are everywhere. Wednesday, 30

    May 12
  24. @iain | #EECI2012 EU Arrays. $entry  =  array(    

       "title"  =>  "Street  Fighter  2",        "some_field"  =>  "Some  value" ); echo  $entry["title"]; Think of variables that can store multiple values. Wednesday, 30 May 12
  25. @iain | #EECI2012 EU Arrays. $entry  =  array(    

       "title"  =>  "Street  Fighter  2"        "players"  =>  array(                "player_1"  =>  "Blanka",                "player_2"  =>  "Dhalsim"        ) ); echo  $entry["players"]["player_1"]; Applying a “Matrix” concept to arrays. Wednesday, 30 May 12
  26. @iain | #EECI2012 EU Arrays. $data  =  array(    

     "vendor"      =>  "Bowers  &  Wilkins",      "location"  =>  "UK",      "rating"      =>  "9.5" ); $this-­‐>EE-­‐>db-­‐>insert('vendors',  $data); Once you understand them, you can start having fun. Wednesday, 30 May 12
  27. @iain | #EECI2012 EU foreach loops Looping through arrays /

    database results to make / get what you need Wednesday, 30 May 12
  28. @iain | #EECI2012 EU Documentation & tutorials can only show

    you so much. Use the source, Luke. Wednesday, 30 May 12
  29. Wednesday, 30 May 12

  30. @iain | #EECI2012 EU Learn from EE itself: system/index.phpS=0&D=cp&C=admin_content&M=category_management Look

    at your CP URL: /system/expressionengine/controllers/cp/admin_content.php We know what controller: function  category_management()... And we know what method: Wednesday, 30 May 12
  31. @iain | #EECI2012 EU Download Bamboo Invoice http:/ /bambooinvoice.org/ bamboo_system_files/application/controllers/

    bamboo_system_files/application/models/ Wednesday, 30 May 12
  32. @iain | #EECI2012 EU LONG PHP BOOKS ARE LONG. Wednesday,

    30 May 12
  33. @iain | #EECI2012 EU PHP COOKBOOK FTW Wednesday, 30 May

  34. @iain | #EECI2012 EU CodeRunner FTW Wednesday, 30 May 12

  35. @iain | #EECI2012 EU Get some SQL Fu. Learn how

    EE stores it’s data Learn how to get what you need out of the database Wednesday, 30 May 12
  36. @iain | #EECI2012 EU Get some SQL Fu. Look at

    the Output Profiler, see what queries make up a page load Admin -> System Administration -> Output & Debugging Wednesday, 30 May 12
  37. @iain | #EECI2012 EU Get some SQL Fu. Take a

    shot at replicating some of EE’s tags using the query module Benchmark performance with your queries against EE’s tags - you might be surprised! {exp:query  sql="SELECT  title  as  the_title        FROM  exp_channel_titles          WHERE  site_id  =  '1'          ORDER  BY  title  ASC"}                {the_title}  <br  /> {/exp:query} Wednesday, 30 May 12
  38. @iain | #EECI2012 EU Open up and tinker with some

    models in /system/expressionengine/models Wednesday, 30 May 12
  39. @iain | #EECI2012 EU $this-­‐>EE-­‐>load-­‐>model('addons_model'); $modules  =  $this-­‐>EE-­‐>addons_model-­‐>get_installed_modules(); print_r(  $modules-­‐>result_array()

     ); Wednesday, 30 May 12
  40. @iain | #EECI2012 EU Wednesday, 30 May 12

  41. @iain | #EECI2012 EU CodeIgniter Bookmarks. Wednesday, 30 May 12

  42. @iain | #EECI2012 EU Form Helper Build your inputs http:/

    /codeigniter.com/user_guide/helpers/form_helper.html <?php  echo  form_input('username');  ?> <input  type="text"  name="username"  value=""  /> Wednesday, 30 May 12
  43. Input Class Access your post/get data and more. http:/ /codeigniter.com/user_guide/libraries/input.html

    @iain | #EECI2012 EU $username  =  $this-­‐>EE-­‐>input-­‐>post('username'); Wednesday, 30 May 12
  44. Active Record Class Retrieve, insert, and update data in your

    database with minimal scripting. http:/ /codeigniter.com/user_guide/database/active_record.html @iain | #EECI2012 EU $data  =  array(        "name"    =>  $this-­‐>EE-­‐>input-­‐>post('username'),      "email"  =>  $this-­‐>EE-­‐>input-­‐>post('email') ); $this-­‐>EE-­‐>db-­‐>insert('people',  $data); Wednesday, 30 May 12
  45. Check how EllisLab do it. @iain | #EECI2012 EU =>

     $this-­‐>input-­‐>post( Search the EE code base for: Wednesday, 30 May 12
  46. @iain | #EECI2012 EU Wednesday, 30 May 12

  47. @iain | #EECI2012 EU On our way. We’ve got our

    heads around basic php functions, and things like arrays. We’re understanding documentation more We’re looking at the source, and know where to look when we want to see what’s happening under the bonnet We’re getting to grips with how EE stores it’s data Wednesday, 30 May 12
  48. HELP. @iain | #EECI2012 EU EE forums - sometimes *crickets*,

    sometimes extremely useful. Follow up with a #eecms tagged tweet with a link to your post. StackOverflow - when you’ve broken problem down to specifics Trawl other add-ons - be careful here Give it a shot, try as best you can. Developers generally see through lazyness and get annoyed with “someone do it for me” type questions. Extract the problem from the bigger picture. Break it down into it’s smallest parts. Step away from the keyboard. Come back later the solution is clear. Wednesday, 30 May 12
  49. Handling clients When you feel like you’re out your depth:

    @iain | #EECI2012 EU Its ok to say “I don’t know, but I will find out for you” Your biggest strength is your understanding of the problem Don’t just keep track of your hours and pass the bill to the client - charge fairly Start with the must have features, and scale into it Get your client on-board, be honest. Trust your gut, early warnings especially Wednesday, 30 May 12
  50. @iain | #EECI2012 EU Going forward Have a sense of

    humour. You will find your own code funny in the following weeks and months. Don’t bag other people’s work. Have respect. Throw your stuff out there, get it on GitHub. Announce it on Twitter - don’t be scared. You get to a tipping point where things start ‘sticking’. It just takes time. Have thick skin - don’t be put off learning when someone calls you out, or has a go. Wednesday, 30 May 12
  51. If your old code isn't bad, you haven't learned anything

    since you wrote it. @iain | #EECI2012 EU — Unkown Wednesday, 30 May 12
  52. FIN. Thank you. @iain | #EECI2012 EU Wednesday, 30 May

  53. Discuss. @iain | #EECI2012 EU Wednesday, 30 May 12