count to 10 and say yes

25
Count to 10 and Say Yes JOHN HENRY DONOVAN Engine Summit 7th June 2011

Upload: john-henry-donovan

Post on 29-Jun-2015

372 views

Category:

Technology


1 download

DESCRIPTION

Originally presented at Engine Summit - The online ExpressionEngine Summit June, 7thth 2011

TRANSCRIPT

Page 1: Count to 10 and Say Yes

Count to 10 and Say Yes

JOHN HENRY DONOVANEngine Summit 7th June 2011

Page 2: Count to 10 and Say Yes
Page 3: Count to 10 and Say Yes

IntroductionWe have all been there. A client emails and makes an unreasonable

feature request. Our first response after the explosion of expletives

would be to say no. But let's count to 10 and rescue the situation.

Page 4: Count to 10 and Say Yes

Lateral thinking• For me personally, lateral thinking plays a big part when designing architecture for a clients web application/site

• It's problem solving at it's lowest common denominator

• In ExpressionEngine these problems present themselves all the time. I call it problem solving but it is really solution finding

• Lateral thinking comes into play the more you become aware of the flexibility that EE has to offer. Your solution depends on the tools and knowledge you have at hand. It's about taking something you know and applying or seeing it in a different way.

• Lets examine one of the most common over thought items in EE

Page 5: Count to 10 and Say Yes

{if news_image == "black"}

<img src="/images/black-image.jpg" />

{if:elseif news_image == "red"}

<img src="/images/red-image.jpg" />

{if:elseif news_image == "yellow"}

<img src="/images/yellow-image.jpg" />

{if:elseif news_image == "green"}

<img src="/images/green-image.jpg" />

{if:elseif news_image == "blue"}

<img src="/images/blue-image.jpg" />

{if:else}

<img src="/images/pink-image.jpg" />

{/if}

Page 6: Count to 10 and Say Yes

<img src="/images/{news_image}-image.jpg" />

Page 7: Count to 10 and Say Yes

The Member Export Tool"We want to be able to export our members into Excel. Looking at

them in EE is all well and good but I want the data available to our

non-webeditors also. We have an a piece of software here in the

office that we want to import our members into"

Page 8: Count to 10 and Say Yes

The Member Export ToolIMMEDIATE THOUGHTS

• I just built you a whole website in ExpressionEngine, why do you

need to do this??

• There must be an add-on that does what they want

• Punt the cat down the stairs

Page 9: Count to 10 and Say Yes

The Member Export ToolLETS THINK ABOUT THIS

• What are the exact reasons behind the client wanting this

• There must be a gap in the workflow I created for them

• It is something out of scope so lets do our best to make his flawless

• Lets cover all angles

• Lets turn this into a project that we can charge a client for and be

happy with the outcome

Page 10: Count to 10 and Say Yes

The Member Export ToolSPEC

• Export as a downloadable CSV file

• Choose today's date

• Choose a specific date

• Choose a date range

• Make it all template based

• Protect it from the public

Page 11: Count to 10 and Say Yes
Page 12: Count to 10 and Say Yes
Page 13: Count to 10 and Say Yes

http://www.mydomain.com/member-export/index

Page 14: Count to 10 and Say Yes

<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8">

<title>Member Data Custom Export Tool</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script> <script src="/global/js/daterangepicker.jQuery.js"></script> <link href="/global/css/ui.daterangepicker.css" type="text/css" rel="stylesheet" /> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/redmond/jquery-ui.css" type="text/css" rel="stylesheet" /> <!-- demo-related styles --> <link rel="stylesheet" type="text/css" media="all" href="{stylesheet=_includes/style}" /> <script type="text/javascript"> $(function(){ $('input#range').daterangepicker( { text: 'My Range', dateStart: '2010-01-01', dateEnd: 'Today', dateFormat:'yy-mm-dd', rangeSplitter:'/', onClose: function(){ var actionDate="/member-export/exporter/"+$("input#range").val(); $("#export-tool").attr("action",actionDate); } } ); }); </script> </head>

/member-export/index

Page 15: Count to 10 and Say Yes

<body> {if logged_out} <h1>Bugger off!</h1> <p>You must be a site administrator to view this page.</p> {if:else} <h1>Member Data Custom Export Tool</h1> <form action="" id="export-tool"> <input type="text" value="Choose dates" id="range" /> <input class="submit" type="submit" value="Download"/> </form> {/if} </body></html>

/member-export/index (continued)

Page 16: Count to 10 and Say Yes

The Member Export Tool

member-export

exporter

today specific date date range

member-export.csv

Page 17: Count to 10 and Say Yes

{if segment_3 == "" AND segment_4 == ""} <h1>Bugger off!</h1> <p>You must be a site administrator to view this page.</p> {/if} <!-- Check for todays date and show correct embed --> {if segment_3 == "{current_time format='%Y-%m-%d'}" AND segment_4 == ""} {embed="member-export/today" date1="{current_time format='Y-%m-%d'}"} {/if} <!-- Check for a specific date and show correct embed --> {if segment_3 != "{current_time format='Y-%m-%d'}" AND segment_4 == "" AND segment_3 != ""} {embed="member-export/specific-date" date1="{segment_3}"} {/if} <!-- Check for a date range and show correct embed --> {if segment_3 != "" && segment_4 != ""} {embed="member-export/date-range" date1="{segment_3}" date2="{segment_4}"} {/if}

/member-export/exporter

Page 18: Count to 10 and Say Yes

The Member Export Tool

member-export

exporter

today specific date date range

member-export.csv

Page 19: Count to 10 and Say Yes

{exp:ajw_exportsql="SELECT m.member_idAS'WebsiteMemberId', date_format(from_unixtime(join_date),'%d/%m/%Y')AS'JoinDate', m.usernameAS'Username', m.emailAS'Email', m.urlAS'URL', m_field_id_1AS'SubscribedtoNewsletter' FROMexp_membersASmLEFTJOINexp_member_dataASdONd.member_id=m.member_id WHEREdate_format(from_unixtime(join_date),'%d-%m-%Y')='{embed:date1}' ORDERBYm.member_idDESC" format="csv"filename="member-export.csv" }

/member-export/today

Page 20: Count to 10 and Say Yes

{exp:ajw_exportsql="SELECT m.member_idAS'WebsiteMemberId', date_format(from_unixtime(join_date),'%d/%m/%Y')AS'JoinDate', m.usernameAS'Username', m.emailAS'Email', m.urlAS'URL', m_field_id_1AS'SubscribedtoNewsletter' FROMexp_membersASmLEFTJOINexp_member_dataASdONd.member_id=m.member_id WHEREdate_format(from_unixtime(join_date),'%d-%m-%Y')='{embed:date1}' ORDERBYm.member_idDESC" format="csv"filename="member-export.csv" }

/member-export/specific-date

Page 21: Count to 10 and Say Yes

/member-export/date-range

{exp:ajw_exportsql="SELECT m.member_idAS'WebsiteMemberId', date_format(from_unixtime(join_date),'%d/%m/%Y')AS'JoinDate', m.usernameAS'Username', m.emailAS'Email', m.urlAS'URL', m_field_id_1AS'SubscribedtoNewsletter' FROMexp_membersASmLEFTJOINexp_member_dataASdONd.member_id=m.member_id WHEREdate_format(from_unixtime(join_date),'%Y-%m-%d')BETWEEN'{embed:date1}'AND'{embed:date2}' ORDERBYm.member_idDESC" format="csv"filename="member-export.csv" }

Page 22: Count to 10 and Say Yes

http://www.mydomain.com/member-export/index

Page 23: Count to 10 and Say Yes
Page 24: Count to 10 and Say Yes

Screenshare time!

Page 25: Count to 10 and Say Yes

Thanks

JOHN HENRY DONOVANhttp://johnhenry.ie

@johnhenry_ie