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.

iainurquhart

May 30, 2012
Tweet

Other Decks in Programming

Transcript

  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. 3.0 Explorer A whole new world has opened up. @iain

    | #EECI2012 EU Wednesday, 30 May 12
  7. 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
  8. 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
  9. @iain | #EECI2012 EU Set some goals. Get to where

    you want to be. Wednesday, 30 May 12
  10. 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
  11. {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
  12. @iain | #EECI2012 EU Lets take a simple PHP function:

    http:/ /php.net/str_replace Wednesday, 30 May 12
  13. {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
  14. 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
  15. @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
  16. @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
  17. @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
  18. @iain | #EECI2012 EU foreach loops Looping through arrays /

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

    you so much. Use the source, Luke. Wednesday, 30 May 12
  20. @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
  21. @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
  22. @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
  23. @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
  24. @iain | #EECI2012 EU Open up and tinker with some

    models in /system/expressionengine/models Wednesday, 30 May 12
  25. @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
  26. 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
  27. 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
  28. Check how EllisLab do it. @iain | #EECI2012 EU =>

     $this-­‐>input-­‐>post( Search the EE code base for: Wednesday, 30 May 12
  29. @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
  30. 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
  31. 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
  32. @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
  33. If your old code isn't bad, you haven't learned anything

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