際際滷

際際滷Share a Scribd company logo
油
Why you can  believe me 4 years of experience
Agenda Development Design MVC Other important questions  Code optimization The most popular mistakes!
Joomla Components development
Model-View-Controller
How many times did you see this? Model View Controller User updates manipulates sees uses
An application is split by 3 departments which  collaborate with each other  to bring you the best results, but they  dont disturb each other  at the same time!
油
MVC Controller
The controller is the boss!
You should use  a controller for Getting request data; Getting model & view instances; Updating model states; Calling model action methods (e.g. delete, save, remove); Calling view methods to render a template.
You should not use  a controller for Database task; Manipulating model data; Rendering templates. model & view tasks
A Controller in Joomla
JController
display() method revealed /libraries/joomla/application/component/controller.php Gets view instance Gets model instance Injects model into view Calls views display() method
Bad approaches for using controllers in Joomla
Good approaches for using controllers in Joomla
Bad approaches for using controllers in Joomla
Good approaches for using controllers in Joomla
MVC Model
A model is a hard worker!
You should use  a model for Storing a state; Performing database tasks; Formatting data; All other data task.
You should not use  a model for Getting request data; Rendering templates. controller & view tasks
A Model in Joomla
JModel The most  unused  model methods & properties. Why? $this->_db $this->_state $this->getDBO(); $this->setState($property, $value); $this->getState($property);
Bad approaches for using models in Joomla
Good approaches for using models in Joomla
Fat Model, Skinny Controller http://blog.astrumfutura.com/archives/373-The_M_in_MVC_Why_Models_are_Misunderstood_and_Unappreciated.html
MVC View
A view is a stylist!
You should use  a view for Rendering templates; Rendering templates; Rendering templates.
You should not use  a view for Database tasks; Database tasks; Database tasks. model tasks
A view in Joomla
JView lies between a model and a template View Data Template
You should use  a Joomla view class for Getting data from models; Rearranging data (if needed); Assigning variables to templates; Rendering templates.
Dont put everything you have into a view!
Keep your view methods small!
You shouldnt use PHP in template files like this
You should use it like this
Dont use variables in view templates other than the ones you assigned to
Keep your templates clear, assign all variables in view classes!
Add CSS and JS in the view template file   in this case they can be overwritten in a Joomla template
Joomla MVC revealed
Joomla MVC default task as it is Main components file request  data calls Controller default task calls JControllers display() Model & view objects gets inserts Model into view calls JViews display() gets Model data renders Template
The best way to figure out the Joomla framework is to dig into the code!
No, seriously Just dig into the code
After digging JController methods you can find out /libraries/joomla/application/component/controller.php How  to insert other than the default model into your view class How to add another location for your model & view files How to set a default model state  and many more
Joomla MVC structures possible variants
油
油
油
Base controller approach
Base controller approach: main component file
Code Optimization
Code Optimization Write code Go! Write a bit more code Think over
A simple optimization Edit, publish, unpublish, save order, order up, order down, cancel, save, remove Base admin model Base admin controller Base admin view Helper classes Get ordering, save order, move, check out, check in,  publish,  remove The most used variables: option, document, view, controller, layout, etc. Everything that can be reused in templates
Code Documentation
Document your code http://www.phpdoc.org/ http://code.google.com/p/jsdoc-toolkit/ Every file, class, class property and method
油
Filter input, escape output! http://shiflett.org/blog/2005/feb/my-top-two-php-security-practices http://developer.joomla.org/security.html http://developer.joomla.org/security/articles-tutorials/258-preventing-sql-injections.html
Joomla Components design
We are developers, we dont do design!
!!!!! We  are  developers, we  dont do  design  !!!!
Design principles for developers Set proper CSS classes & IDs, but leave design for template designers Thats all!
Thanks for coming! http://twitter.com/onesterov http://onesterov.com http://jookungfu.org http://mindk-lab.com [email_address]

More Related Content

What's hot (6)

PPT
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
ODP
Spec & Test Helper
grosser
PDF
Introduction to Mantis
rashid4best
PDF
Joomla Custom Fields - the next level
Hans Kuijpers
PPTX
Html Server Image Control CS
sunmitraeducation
PPTX
Design your tests to behave - An introduction To BDD!
Aparna A Gopalakrishnan
MVC From Beginner to Advance in Indian Style by - Indiandotnet
Indiandotnet
Spec & Test Helper
grosser
Introduction to Mantis
rashid4best
Joomla Custom Fields - the next level
Hans Kuijpers
Html Server Image Control CS
sunmitraeducation
Design your tests to behave - An introduction To BDD!
Aparna A Gopalakrishnan

Similar to Joomla Extensions Kung Fu (20)

PDF
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Ofer Cohen
PPT
Advance Component Development by Azrul Rahim
John Coonen
PDF
Jab12 - Joomla! architecture revealed
Ofer Cohen
PPTX
Develop Basic joomla! MVC component for version 3
Gunjan Patel
PDF
Learning Joomla! in a weekend (for developers)
Valentin Despa
PPT
Rapid application development with FOF
Nicholas Dionysopoulos
PDF
Php and-mvc
Manoj Sahoo
KEY
FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012
Nicholas Dionysopoulos
PPT
Joomla Day Austin Part 4
Kyle Ledbetter
KEY
JWC - Rapid application development with FOF
Nicholas Dionysopoulos
PPTX
Less is More by Matt Christensen
jdaychi
PDF
PHP & MVC
Chris Weldon
ODP
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
KEY
Joomla - an Overview
Mitch Pirtle
KEY
Developing Joomla! 1.5 Extensions, Explained
Mitch Pirtle
PDF
JAB14 Honey I shrunk the code
CB Team @ Joomlapolis
PDF
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
Ravi Bhadauria
ODP
Joomla presentation for PHPCamp 2011
Parth Lawate
PDF
Basics of Joomla!
Saurabh Shah
Joomla!Day Poland 2013 - Joomla Architecture (Ofer Cohen)
Ofer Cohen
Advance Component Development by Azrul Rahim
John Coonen
Jab12 - Joomla! architecture revealed
Ofer Cohen
Develop Basic joomla! MVC component for version 3
Gunjan Patel
Learning Joomla! in a weekend (for developers)
Valentin Despa
Rapid application development with FOF
Nicholas Dionysopoulos
Php and-mvc
Manoj Sahoo
FOF Rapid Application Development on Joomla! - Joomla! Day Denmark 2012
Nicholas Dionysopoulos
Joomla Day Austin Part 4
Kyle Ledbetter
JWC - Rapid application development with FOF
Nicholas Dionysopoulos
Less is More by Matt Christensen
jdaychi
PHP & MVC
Chris Weldon
Joomla Day India 2009 Business Logic With The Mvc
Amit Kumar Singh
Joomla - an Overview
Mitch Pirtle
Developing Joomla! 1.5 Extensions, Explained
Mitch Pirtle
JAB14 Honey I shrunk the code
CB Team @ Joomlapolis
MVC Design Pattern in JavaScript by ADMEC Multimedia Institute
Ravi Bhadauria
Joomla presentation for PHPCamp 2011
Parth Lawate
Basics of Joomla!
Saurabh Shah
Ad

Recently uploaded (20)

PDF
Scaling i.MX Applications Processors Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
PDF
UiPath Agentic AI ile Ak脹ll脹 Otomasyonun Yeni a脹
UiPathCommunity
PDF
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
PPTX
Practical Applications of AI in Local Government
OnBoard
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
PDF
Unlocking FME Flows Potential: Architecture Design for Modern Enterprises
Safe Software
PDF
MPU+: A Transformative Solution for Next-Gen AI at the Edge, a Presentation...
Edge AI and Vision Alliance
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
PPTX
Simplifica la seguridad en la nube y la detecci坦n de amenazas con FortiCNAPP
Cristian Garcia G.
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
Scaling i.MX Applications Processors Native Edge AI with Discrete AI Accele...
Edge AI and Vision Alliance
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
UiPath Agentic AI ile Ak脹ll脹 Otomasyonun Yeni a脹
UiPathCommunity
Optimizing the trajectory of a wheel loader working in short loading cycles
Reno Filla
Practical Applications of AI in Local Government
OnBoard
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
Unlocking FME Flows Potential: Architecture Design for Modern Enterprises
Safe Software
MPU+: A Transformative Solution for Next-Gen AI at the Edge, a Presentation...
Edge AI and Vision Alliance
Why aren't you using FME Flow's CPU Time?
Safe Software
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
Python Conference Singapore - 19 Jun 2025
ninefyi
Simplifica la seguridad en la nube y la detecci坦n de amenazas con FortiCNAPP
Cristian Garcia G.
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
Open Source Milvus Vector Database v 2.6
Zilliz
Ad

Joomla Extensions Kung Fu