SlideShare uma empresa Scribd logo
1 de 25
Baixar para ler offline
Count to 10 and Say Yes
     JOHN HENRY DONOVAN
      Engine Summit 7th June 2011
Introduction
We 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.
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
{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}
<img src="/images/{news_image}-image.jpg" />
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"
The Member Export Tool
IMMEDIATE 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
The Member Export Tool
LETS 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
The Member Export Tool
SPEC

•	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
http://www.mydomain.com/member-export/index
/member-export/index
<!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 (continued)



		      <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>
The Member Export Tool
               member-export




                  exporter




    today        specific date   date range



            member-export.csv
/member-export/exporter

	 {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}
The Member Export Tool
               member-export




                  exporter




    today        specific date   date range



            member-export.csv
/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"
	   }
/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"
	 }
/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"
	 }
http://www.mydomain.com/member-export/index
Screenshare time!
Thanks
JOHN HENRY DONOVAN
    http://johnhenry.ie
      @johnhenry_ie

Mais conteúdo relacionado

Mais procurados

20111014 mu me_j_querymobile
20111014 mu me_j_querymobile20111014 mu me_j_querymobile
20111014 mu me_j_querymobile
Erik Duval
 
WordPress Third Party Authentication
WordPress Third Party AuthenticationWordPress Third Party Authentication
WordPress Third Party Authentication
Aaron Brazell
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Events
dmethvin
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API Development
Andrew Curioso
 
Client side development with knockout.js
Client side development with knockout.jsClient side development with knockout.js
Client side development with knockout.js
Valdis Iljuconoks
 
Introduction to Zend_Pdf
Introduction to Zend_PdfIntroduction to Zend_Pdf
Introduction to Zend_Pdf
dennisdc
 

Mais procurados (18)

20111014 mu me_j_querymobile
20111014 mu me_j_querymobile20111014 mu me_j_querymobile
20111014 mu me_j_querymobile
 
WordPress Third Party Authentication
WordPress Third Party AuthenticationWordPress Third Party Authentication
WordPress Third Party Authentication
 
jQuery 1.7 Events
jQuery 1.7 EventsjQuery 1.7 Events
jQuery 1.7 Events
 
Working with Javascript in Rails
Working with Javascript in RailsWorking with Javascript in Rails
Working with Javascript in Rails
 
WordPress as a Content Management System
WordPress as a Content Management SystemWordPress as a Content Management System
WordPress as a Content Management System
 
Architecture, Auth, and Routing with uiRouter
Architecture, Auth, and Routing with uiRouterArchitecture, Auth, and Routing with uiRouter
Architecture, Auth, and Routing with uiRouter
 
Cakefest 2010: API Development
Cakefest 2010: API DevelopmentCakefest 2010: API Development
Cakefest 2010: API Development
 
Client side development with knockout.js
Client side development with knockout.jsClient side development with knockout.js
Client side development with knockout.js
 
Single Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and RailsSingle Page Web Apps with Backbone.js and Rails
Single Page Web Apps with Backbone.js and Rails
 
jQuery Plugin
jQuery PluginjQuery Plugin
jQuery Plugin
 
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
 
Devoxx 2014-webComponents
Devoxx 2014-webComponentsDevoxx 2014-webComponents
Devoxx 2014-webComponents
 
Turn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modulesTurn your spaghetti code into ravioli with JavaScript modules
Turn your spaghetti code into ravioli with JavaScript modules
 
[ WrocLoveRb 2012] user perspective testing using ruby
[ WrocLoveRb 2012] user perspective testing using ruby[ WrocLoveRb 2012] user perspective testing using ruby
[ WrocLoveRb 2012] user perspective testing using ruby
 
Introduction to Zend_Pdf
Introduction to Zend_PdfIntroduction to Zend_Pdf
Introduction to Zend_Pdf
 
Dicas de palestra
Dicas de palestraDicas de palestra
Dicas de palestra
 
Angular 2.0 Routing and Navigation
Angular 2.0 Routing and NavigationAngular 2.0 Routing and Navigation
Angular 2.0 Routing and Navigation
 
Laravel admin20170819
Laravel admin20170819Laravel admin20170819
Laravel admin20170819
 

Destaque

Amir33202057 2013 03-17-19-06-07
Amir33202057 2013 03-17-19-06-07Amir33202057 2013 03-17-19-06-07
Amir33202057 2013 03-17-19-06-07
Dushyant Kumar
 
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
Eric Hyman
 
4月23日説明会
4月23日説明会4月23日説明会
4月23日説明会
tetsuro ooki
 
Are you and your computer guy praying 3
Are you and your computer guy praying 3Are you and your computer guy praying 3
Are you and your computer guy praying 3
Phil Hutchins
 
Currency matters trading platform vision v1.1
Currency matters trading platform vision v1.1Currency matters trading platform vision v1.1
Currency matters trading platform vision v1.1
HBS Technologies
 

Destaque (20)

Enterprise Risk Management
Enterprise Risk ManagementEnterprise Risk Management
Enterprise Risk Management
 
Government encourages education loan
Government encourages education loanGovernment encourages education loan
Government encourages education loan
 
Jquery for post a form
Jquery for post a formJquery for post a form
Jquery for post a form
 
Good mobile design of financial industry websites
Good mobile design of financial industry websitesGood mobile design of financial industry websites
Good mobile design of financial industry websites
 
Amir33202057 2013 03-17-19-06-07
Amir33202057 2013 03-17-19-06-07Amir33202057 2013 03-17-19-06-07
Amir33202057 2013 03-17-19-06-07
 
Q1.0 [Quiz Quirks]
Q1.0 [Quiz Quirks]Q1.0 [Quiz Quirks]
Q1.0 [Quiz Quirks]
 
From User to Global: A Spectrum of Experience
From User to Global: A Spectrum of ExperienceFrom User to Global: A Spectrum of Experience
From User to Global: A Spectrum of Experience
 
Ship It!
Ship It!Ship It!
Ship It!
 
Small business solutions worldwide
Small business solutions worldwideSmall business solutions worldwide
Small business solutions worldwide
 
Automated Test Design: Single Use Vs Reusable Tests
Automated Test Design: Single Use Vs Reusable TestsAutomated Test Design: Single Use Vs Reusable Tests
Automated Test Design: Single Use Vs Reusable Tests
 
Digitalisierung mit UNIT4
Digitalisierung mit UNIT4Digitalisierung mit UNIT4
Digitalisierung mit UNIT4
 
Starting up - Lessons learned from the trenches
Starting up - Lessons learned from the trenchesStarting up - Lessons learned from the trenches
Starting up - Lessons learned from the trenches
 
Digital economy with the speed of s4 hana
Digital economy with the speed of s4 hanaDigital economy with the speed of s4 hana
Digital economy with the speed of s4 hana
 
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
EarthLink Top 5 Questions Asked of EarthLInk Network Engineers 2016
 
4月23日説明会
4月23日説明会4月23日説明会
4月23日説明会
 
Business Intelligence: A Financial Perspective
Business Intelligence: A Financial PerspectiveBusiness Intelligence: A Financial Perspective
Business Intelligence: A Financial Perspective
 
Are you and your computer guy praying 3
Are you and your computer guy praying 3Are you and your computer guy praying 3
Are you and your computer guy praying 3
 
Serveau software f
Serveau software fServeau software f
Serveau software f
 
Currency matters trading platform vision v1.1
Currency matters trading platform vision v1.1Currency matters trading platform vision v1.1
Currency matters trading platform vision v1.1
 
HubSpot Activation on BlueCamroo
HubSpot Activation on BlueCamrooHubSpot Activation on BlueCamroo
HubSpot Activation on BlueCamroo
 

Semelhante a Count to 10 and Say Yes

Private slideshow
Private slideshowPrivate slideshow
Private slideshow
sblackman
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
Justin Cataldo
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
Anthony Montalbano
 

Semelhante a Count to 10 and Say Yes (20)

Building iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" DominoBuilding iPhone Web Apps using "classic" Domino
Building iPhone Web Apps using "classic" Domino
 
Private slideshow
Private slideshowPrivate slideshow
Private slideshow
 
Once Source to Rule Them All
Once Source to Rule Them AllOnce Source to Rule Them All
Once Source to Rule Them All
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
Design Patterns for JavaScript Web Apps - JavaScript Conference 2012 - OPITZ ...
Design Patterns for JavaScript Web Apps - JavaScript Conference 2012 - OPITZ ...Design Patterns for JavaScript Web Apps - JavaScript Conference 2012 - OPITZ ...
Design Patterns for JavaScript Web Apps - JavaScript Conference 2012 - OPITZ ...
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 
Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...Max Voloshin - "Organization of frontend development for products with micros...
Max Voloshin - "Organization of frontend development for products with micros...
 
Site optimization
Site optimizationSite optimization
Site optimization
 
Xxx
XxxXxx
Xxx
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Pengenalan AngularJS
Pengenalan AngularJSPengenalan AngularJS
Pengenalan AngularJS
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Your Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages SuckYour Custom WordPress Admin Pages Suck
Your Custom WordPress Admin Pages Suck
 
Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015Why you should be using Web Components. And How - DevWeek 2015
Why you should be using Web Components. And How - DevWeek 2015
 
关于 Html5 那点事
关于 Html5 那点事关于 Html5 那点事
关于 Html5 那点事
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
 
Borrador del blog
Borrador del blogBorrador del blog
Borrador del blog
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Count to 10 and Say Yes

  • 1. Count to 10 and Say Yes JOHN HENRY DONOVAN Engine Summit 7th June 2011
  • 2.
  • 3. Introduction We 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.
  • 4. 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
  • 5. {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}
  • 7. 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"
  • 8. The Member Export Tool IMMEDIATE 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
  • 9. The Member Export Tool LETS 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
  • 10. The Member Export Tool SPEC • 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
  • 11.
  • 12.
  • 14. /member-export/index <!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>
  • 15. /member-export/index (continued) <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>
  • 16. The Member Export Tool member-export exporter today specific date date range member-export.csv
  • 17. /member-export/exporter {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}
  • 18. The Member Export Tool member-export exporter today specific date date range member-export.csv
  • 19. /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" }
  • 20. /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" }
  • 21. /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" }
  • 23.
  • 25. Thanks JOHN HENRY DONOVAN http://johnhenry.ie @johnhenry_ie