count to 10 and say yes

Download Count to 10 and Say Yes

Post on 29-Jun-2015

363 views

Category:

Technology

1 download

Embed Size (px)

DESCRIPTION

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

TRANSCRIPT

  • 1. Count to 10 and Say Yes JOHN HENRY DONOVANEngine Summit 7th June 2011

2. IntroductionWe have all been there. A client emails and makes an unreasonablefeature request. Our first response after the explosion of expletiveswould be to say no. But lets count to 10 and rescue the situation. 3. Lateral thinkingFor me personally, lateral thinking plays a big part when designingarchitecture for a clients web application/siteIts problem solving at its lowest common denominatorIn ExpressionEngine these problems present themselves all thetime. I call it problem solving but it is really solution findingLateral thinking comes into play the more you become aware of theflexibility that EE has to offer. Your solution depends on the toolsand knowledge you have at hand. Its about taking something youknow and applying or seeing it in a different way.Lets examine one of the most common over thought items in EE 4. {if news_image == "black"} {if:elseif news_image == "red"} {if:elseif news_image == "yellow"} {if:elseif news_image == "green"} {if:elseif news_image == "blue"} {if:else} {/if} 5. 6. The Member Export Tool"We want to be able to export our members into Excel. Looking atthem in EE is all well and good but I want the data available to ournon-webeditors also. We have an a piece of software here in theoffice that we want to import our members into" 7. The Member Export ToolIMMEDIATE THOUGHTSI 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 wantPunt the cat down the stairs 8. The Member Export ToolLETS THINK ABOUT THISWhat are the exact reasons behind the client wanting thisThere must be a gap in the workflow I created for themIt is something out of scope so lets do our best to make his flawlessLets cover all anglesLets turn this into a project that we can charge a client for and be happy with the outcome 9. The Member Export ToolSPECExport as a downloadable CSV fileChoose todays dateChoose a specific dateChoose a date rangeMake it all template basedProtect it from the public 10. http://www.mydomain.com/member-export/index 11. /member-export/index Member Data Custom Export Tool $(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); } } ); }); 12. /member-export/index (continued){if logged_out} Bugger off!

You must be a site administrator to view this page.

{if:else}Member Data Custom Export Tool {/if} 13. The Member Export Tool member-exportexportertodayspecific date date rangemember-export.csv 14. /member-export/exporter {if segment_3 == "" AND segment_4 == ""}Bugger off!

You must be a site administrator to view this page.

{/if} {if segment_3 == "{current_time format=%Y-%m-%d}" AND segment_4 == ""} {embed="member-export/today" date1="{current_time format=Y-%m-%d}"} {/if} {if segment_3 != "{current_time format=Y-%m-%d}" AND segment_4 == "" AND segment_3 != ""} {embed="member-export/specific-date" date1="{segment_3}"} {/if} {if segment_3 != "" && segment_4 != ""} {embed="member-export/date-range" date1="{segment_3}" date2="{segment_4}"} {/if} 15. The Member Export Tool member-exportexportertodayspecific date date rangemember-export.csv 16. /member-export/today {exp:ajw_export sql="SELECT m.member_id AS Website Member Id, date_format(from_unixtime(join_date), %d/%m/%Y) AS Join Date, m.username AS Username, m.email AS Email, m.url AS URL, m_field_id_1 AS Subscribed to Newsletter FROM exp_members AS m LEFT JOIN exp_member_data AS d ON d.member_id = m.member_id WHERE date_format(from_unixtime(join_date), %d-%m-%Y)={embed:date1} ORDER BY m.member_id DESC" format="csv" filename="member-export.csv" } 17. /member-export/specific-date{exp:ajw_export sql="SELECT m.member_id AS Website Member Id, date_format(from_unixtime(join_date), %d/%m/%Y) AS Join Date, m.username AS Username, m.email AS Email, m.url AS URL, m_field_id_1 AS Subscribed to Newsletter FROM exp_members AS m LEFT JOIN exp_member_data AS d ON d.member_id = m.member_id WHERE date_format(from_unixtime(join_date), %d-%m-%Y)={embed:date1} ORDER BY m.member_id DESC" format="csv" filename="member-export.csv" } 18. /member-export/date-range {exp:ajw_export sql="SELECT m.member_id AS Website Member Id, date_format(from_unixtime(join_date), %d/%m/%Y) AS Join Date, m.username AS Username, m.email AS Email, m.url AS URL, m_field_id_1 AS Subscribed to Newsletter FROM exp_members AS m LEFT JOIN exp_member_data AS d ON d.member_id = m.member_id WHERE date_format(from_unixtime(join_date), %Y-%m-%d) BETWEEN {embed:date1} AND{embed:date2} ORDER BY m.member_id DESC" format="csv" filename="member-export.csv" } 19. http://www.mydomain.com/member-export/index 20. Screenshare time! 21. ThanksJOHN HENRY DONOVANhttp://johnhenry.ie@johnhenry_ie