SlideShare une entreprise Scribd logo
1  sur  13
10 things you are doing
Wrong in joomla
Ashwin date | @coolbung
2nd
august 2014
1. file paths
require_once JPATH_SITE.DS.'components'.DS.'com_community'.DS.'helper.php'
Looks ugly. It needn't. You can use this without worrying about
Linux/Windows/mac compatibility
require_once JPATH_SITE.'/components/com_community/helper.php'
This is perfectly fine and much readable. Also easier to write
2. Closing php files
<?php
$my = Jfactory::getUser();
?>
Avoid adding a closing php tags at the end of the file. You can
corrupt json output or other headers
<?php
$my = Jfactory::getUser();
?>
<?
$db = Jfactory::getDBO();
// no closing PHP tag
3. testing without debug & sef
Otherwise you might have nightmare when you
turn these on!
●
No warnings/notices
●
No database query issues
●
Custom components work with sef urls
4. hacking core files
Obvious.. duh ? Override!
I know it's obvious but sometimes the temptation
to hack is just too much and needs to be
avoided.
5. directly using get / post
Use jinput. Period.
<?php
$input = JFactory::getApplication()­>input;
$option = $input­>get('option');
6. directly editing language
overrides
there's an overrides manager for that in the
joomla admin!
7. not adding cache, suffix and other
module params
They're there for a reason!
Cache - suffix – bootstrap size – alternate layout
and there's a few more
8. multiple jquery
8. multiple jquery
I hope this was clear enough ?
8. multiple jquery
9. Writing sql queries directly
$query = “SELECT id, name FROM #__users”;
If ($username) {
$query .= ' username='.$db­>Quote($username);
This is how dummies do it -
Smart kids do it smart -
$query = $db­>query();
$query­>select('id,name');
$query­>from('#__users');
If ($username) {
$query­>where('username='.$db­>Quote($username));
10. large js & css
●
Write efficient javascript
●
Use a single minified, compressed js
●
Write efficient css
●
Use a single minified, compressed css
●
Use smaller components of 3rd
party js plugins
11. your favourites ?
Thank you!
Questions ?

Contenu connexe

Tendances

WordPress Security - Dealing With Today's Hacks
WordPress Security - Dealing With Today's HacksWordPress Security - Dealing With Today's Hacks
WordPress Security - Dealing With Today's Hacks
Tony Perez
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
jgarifuna
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
Michele Orru
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
dswork
 
W.E.B. 2010 - Web, Exploits, Browsers
W.E.B. 2010 - Web, Exploits, BrowsersW.E.B. 2010 - Web, Exploits, Browsers
W.E.B. 2010 - Web, Exploits, Browsers
Saumil Shah
 

Tendances (20)

PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Project
 
Introduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap BuildIntroduction to PhoneGap and PhoneGap Build
Introduction to PhoneGap and PhoneGap Build
 
David Rey Lessons Learned Updating Content Licensing To Be Plone 3 Compat...
David Rey   Lessons Learned   Updating Content Licensing To Be Plone 3 Compat...David Rey   Lessons Learned   Updating Content Licensing To Be Plone 3 Compat...
David Rey Lessons Learned Updating Content Licensing To Be Plone 3 Compat...
 
Practical Exploitation - Webappy Style
Practical Exploitation - Webappy StylePractical Exploitation - Webappy Style
Practical Exploitation - Webappy Style
 
WordPress Security - Dealing With Today's Hacks
WordPress Security - Dealing With Today's HacksWordPress Security - Dealing With Today's Hacks
WordPress Security - Dealing With Today's Hacks
 
โปรแกรม Flash
โปรแกรม Flashโปรแกรม Flash
โปรแกรม Flash
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
 
Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)Riereta Node.js session 3 (with notes)
Riereta Node.js session 3 (with notes)
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlJoomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
 
JavaScript Performance Patterns
JavaScript Performance PatternsJavaScript Performance Patterns
JavaScript Performance Patterns
 
Progressive Enhancement
Progressive EnhancementProgressive Enhancement
Progressive Enhancement
 
WordPress Troubleshooting
WordPress TroubleshootingWordPress Troubleshooting
WordPress Troubleshooting
 
Flu3nt highlights
Flu3nt highlightsFlu3nt highlights
Flu3nt highlights
 
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
Philipp Von Weitershausen   Plone Age  Mammoths, Sabers And Caveen   Cant The...Philipp Von Weitershausen   Plone Age  Mammoths, Sabers And Caveen   Cant The...
Philipp Von Weitershausen Plone Age Mammoths, Sabers And Caveen Cant The...
 
Choosing JavaScript Libraries - Refresh-Detroit.org
Choosing JavaScript Libraries - Refresh-Detroit.orgChoosing JavaScript Libraries - Refresh-Detroit.org
Choosing JavaScript Libraries - Refresh-Detroit.org
 
Attacker Ghost Stories - ShmooCon 2014
Attacker Ghost Stories - ShmooCon 2014Attacker Ghost Stories - ShmooCon 2014
Attacker Ghost Stories - ShmooCon 2014
 
High Performance Social Plugins
High Performance Social PluginsHigh Performance Social Plugins
High Performance Social Plugins
 
Fast Loading JavaScript
Fast Loading JavaScriptFast Loading JavaScript
Fast Loading JavaScript
 
W.E.B. 2010 - Web, Exploits, Browsers
W.E.B. 2010 - Web, Exploits, BrowsersW.E.B. 2010 - Web, Exploits, Browsers
W.E.B. 2010 - Web, Exploits, Browsers
 

Similaire à 10 things you are doing wrong in Joomla

php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
tutorialsruby
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
DrupalCampDN
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
tutorialsruby
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
tutorialsruby
 
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студіїТарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
LEDC 2016
 
Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1
jimbojsb
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
Joshua Warren
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
Helgi Þormar Þorbjörnsson
 

Similaire à 10 things you are doing wrong in Joomla (20)

WordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPressWordCamp SF 2011: Debugging in WordPress
WordCamp SF 2011: Debugging in WordPress
 
PHP
PHP PHP
PHP
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
php-and-zend-framework-getting-started
php-and-zend-framework-getting-startedphp-and-zend-framework-getting-started
php-and-zend-framework-getting-started
 
How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.How to? Drupal developer toolkit. Dennis Povshedny.
How to? Drupal developer toolkit. Dennis Povshedny.
 
Drupal development
Drupal development Drupal development
Drupal development
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студіїТарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
Тарас Кирилюк та Олена Пустовойт — CI workflow у веб-студії
 
Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1Fall 2011 PHP Class - Session 1
Fall 2011 PHP Class - Session 1
 
Chef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructureChef - industrialize and automate your infrastructure
Chef - industrialize and automate your infrastructure
 
CI workflow in a web studio
CI workflow in a web studioCI workflow in a web studio
CI workflow in a web studio
 
PHP Sessions and Non-Sessions
PHP Sessions and Non-SessionsPHP Sessions and Non-Sessions
PHP Sessions and Non-Sessions
 
Debian packaging
Debian packagingDebian packaging
Debian packaging
 
Behavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWestBehavior & Specification Driven Development in PHP - #OpenWest
Behavior & Specification Driven Development in PHP - #OpenWest
 
Towards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev MachineTowards the perfect Drupal Dev Machine
Towards the perfect Drupal Dev Machine
 
Start using PHP 7
Start using PHP 7Start using PHP 7
Start using PHP 7
 
Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009Website releases made easy with the PEAR installer, OSCON 2009
Website releases made easy with the PEAR installer, OSCON 2009
 

Plus de Ashwin Date

Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014
Ashwin Date
 

Plus de Ashwin Date (11)

Building modern frontends for joomla
Building modern frontends for joomlaBuilding modern frontends for joomla
Building modern frontends for joomla
 
King of Fruits - Theme based Gamification
King of Fruits - Theme based GamificationKing of Fruits - Theme based Gamification
King of Fruits - Theme based Gamification
 
Angular frontends with joomla backend
Angular frontends with joomla backendAngular frontends with joomla backend
Angular frontends with joomla backend
 
Revolutionizing kids education using joomla
Revolutionizing kids education using joomlaRevolutionizing kids education using joomla
Revolutionizing kids education using joomla
 
Joomla! Itemid amd routing explained
Joomla! Itemid amd routing explainedJoomla! Itemid amd routing explained
Joomla! Itemid amd routing explained
 
Git basics
Git basicsGit basics
Git basics
 
Caching and Performance Improvememts in Joomla
Caching and Performance Improvememts in JoomlaCaching and Performance Improvememts in Joomla
Caching and Performance Improvememts in Joomla
 
Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014Joomla REST API - JoomlaDay Bangkok 2014
Joomla REST API - JoomlaDay Bangkok 2014
 
How Joomla powers one of the biggest grain warehouses in India
How Joomla powers one of the biggest grain warehouses in IndiaHow Joomla powers one of the biggest grain warehouses in India
How Joomla powers one of the biggest grain warehouses in India
 
Deploying Joomla sites with GIT
Deploying Joomla sites with GITDeploying Joomla sites with GIT
Deploying Joomla sites with GIT
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 

10 things you are doing wrong in Joomla

  • 1. 10 things you are doing Wrong in joomla Ashwin date | @coolbung 2nd august 2014
  • 2. 1. file paths require_once JPATH_SITE.DS.'components'.DS.'com_community'.DS.'helper.php' Looks ugly. It needn't. You can use this without worrying about Linux/Windows/mac compatibility require_once JPATH_SITE.'/components/com_community/helper.php' This is perfectly fine and much readable. Also easier to write
  • 3. 2. Closing php files <?php $my = Jfactory::getUser(); ?> Avoid adding a closing php tags at the end of the file. You can corrupt json output or other headers <?php $my = Jfactory::getUser(); ?> <? $db = Jfactory::getDBO(); // no closing PHP tag
  • 4. 3. testing without debug & sef Otherwise you might have nightmare when you turn these on! ● No warnings/notices ● No database query issues ● Custom components work with sef urls
  • 5. 4. hacking core files Obvious.. duh ? Override! I know it's obvious but sometimes the temptation to hack is just too much and needs to be avoided.
  • 6. 5. directly using get / post Use jinput. Period. <?php $input = JFactory::getApplication()­>input; $option = $input­>get('option');
  • 7. 6. directly editing language overrides there's an overrides manager for that in the joomla admin!
  • 8. 7. not adding cache, suffix and other module params They're there for a reason! Cache - suffix – bootstrap size – alternate layout and there's a few more
  • 9. 8. multiple jquery 8. multiple jquery I hope this was clear enough ? 8. multiple jquery
  • 10. 9. Writing sql queries directly $query = “SELECT id, name FROM #__users”; If ($username) { $query .= ' username='.$db­>Quote($username); This is how dummies do it - Smart kids do it smart - $query = $db­>query(); $query­>select('id,name'); $query­>from('#__users'); If ($username) { $query­>where('username='.$db­>Quote($username));
  • 11. 10. large js & css ● Write efficient javascript ● Use a single minified, compressed js ● Write efficient css ● Use a single minified, compressed css ● Use smaller components of 3rd party js plugins

Notes de l'éditeur

  1. Add/edit/delete/trash articles Common category manager Menu containers &amp; menu types &amp; menu options Templates Modules &amp; module config options, template positions Assigning template to menus Plugins – built-in types &amp; configuration