SlideShare a Scribd company logo
1 of 24
Download to read offline
june 2 0 1 1




THEME LIKE A MONSTER
        MAREK SOTAK | ATOMIC ANT

                 www.atomicant.co.uk
OH HAI!
ABOUT ME & ATOMIC ANT



 ● Web designer, developer
 ● Over 5 years with Drupal - since v4.6
 ● International team
 ● active in Drupal community - rootcandy, organising
   events
@sotak -- http://sotak.co.uk - http://atomicant.co.uk
DREAM JOB!
NOT REALLY



 ● They've called in
 ● Job I didn't really want to do
 ● Little tweaks, that's what they've said
DREAM JOB!
NOT REALLY
DREAM JOB!
NOT REALLY
DREAM JOB!
NOT REALLY
OH WELL
OH YEAH



 ● theme in /themes folder
 ● multisite approach? no? - http://drupal.org/node/53705
OH WELL
OH YEAH



 ● cloning Garland (any contrib theme - how to)
 ● you better sub-theme! - http://drupal.org/node/225125
LIKE A SHERLOCK
OH YEAH



 ● Ctrl+U, browsing the theme's folder, wait...
LIKE A SHERLOCK
OH YEAH



 ● 109 files? structure?




                           Problem?
LIKE A SHERLOCK
OH YEAH
THAT MOMENT
NIGHTMARE NO. 1



  ● How many libraries you have? Sorry?
  ● elmstreet.info




jsearchbox.js - custom js, copied? a js function getElementsByClassName?
HARDCODED
NIGHTMARE NO. 2



 ● hardcoded <link>s and <script>s
   <head>
   <?php print $head ?>
   <title><?php print $head_title ?></title>
   <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() .
   path_to_theme();?>/common.css?G" />
   <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() .
   path_to_theme();?>/style.css?G" />
   <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() .
   path_to_theme();?>/pc-menu.css?G" />
    <?php print $scripts ?>
   </head>
HARDCODED
NIGHTMARE NO. 2



 ● no $styles variable?
 ● how about drupal/modules css?
 ● aggregation?
 ● exception hardcoded link - conditional stylesheets




 ● want to remove styles? do it in .info file
 stylesheets[all][] = system-menus.css
 hook_css_alter();
$CLOSURE
NIGHTMARE NO. 3



 ● page.tpl.php

   </div>
   <?php require_once($_SERVER['DOCUMENT_ROOT']
   ."/themes/elmstreet/google_analytics.php");
   ?>
   </body>
   </html>
 ● oh, you already have google analytics module?
C A M P B L O O D F R I D A Y 1 3 th
NIGHTMARE NO. 4



 ● template.php




 ● Copy, paste but THINK!
C A M P B L O O D F R I D A Y 1 3 th
NIGHTMARE NO. 4



 ● functions like garland_xxx - leftovers
 ● custom functions get_user(), groupdetails(),...
     ○ _mytheme_get_user(), mytheme_groupdetails()
SQL QUERIES
NIGHTMARE NO. 5




                  JUST DON'T
FORM API MISUSE
NIGHTMARE NO. 6



 ● Oh Hai "elmstreet_mysearchform" in template.php
 ● FAPI syntax, returns form array - but where is this being
   called from?




 ● in page.tpl.php via drupal_get_form?
UNEXPLAINABLE
NIGHTMARE NO. 7



 ● Remember?
 ● So they probably wanted to have a template suggestions
   for specific pages incl. headers
UNEXPLAINABLE
NIGHTMARE NO. 7



<?php $nodenid = $node->nid; ?>
<?php if ($nodenid == '142') { include('page_mpffe.tpl.php'); return; } ?>
<?php if ($nodenid == '131') { include('page_sca.tpl.php'); return; } ?>
<?php if ($override == 'mpffe') { include('page_mpffe_other.tpl.php');
return; } ?>
<?php if ($override == 'sca') { include('page_sca_other.tpl.php'); return; } ?>
<?php if ($override == 'cppce') { include('page_cppce_other.tpl.php'); return;
} ?>
<?php if ($override == 'ankpg') { include('page_ankpg_other.tpl.php');
return; } ?>
UNEXPLAINABLE
NIGHTMARE NO. 7



 ● we have custom suggestions
    ○ D6 - template_files, template_file
    ○ D7 - $variables['theme_hook_suggestions']
OKAY
CONCLUSION
QUESTIONS
GOT ANY NIGHTMARES?



twitter: @sotak
http://sotak.co.uk
http://atomicant.co.uk

More Related Content

What's hot

Word press templates
Word press templatesWord press templates
Word press templates
Dan Phiffer
 
LESS is More
LESS is MoreLESS is More
LESS is More
jsmith92
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
jsmith92
 

What's hot (20)

Word press templates
Word press templatesWord press templates
Word press templates
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
 
Theme Kickstart
Theme KickstartTheme Kickstart
Theme Kickstart
 
i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016i18n for Plugin and Theme Developers, WordCamp Milano 2016
i18n for Plugin and Theme Developers, WordCamp Milano 2016
 
Designing Firefox Themes
Designing Firefox ThemesDesigning Firefox Themes
Designing Firefox Themes
 
Design to Theme @ CMSExpo
Design to Theme @ CMSExpoDesign to Theme @ CMSExpo
Design to Theme @ CMSExpo
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to life
 
Using Core Themes in Drupal 8
Using Core Themes in Drupal 8Using Core Themes in Drupal 8
Using Core Themes in Drupal 8
 
LESS is More
LESS is MoreLESS is More
LESS is More
 
WordPress theme frameworks
WordPress theme frameworksWordPress theme frameworks
WordPress theme frameworks
 
Drupal 7 Theme System
Drupal 7 Theme SystemDrupal 7 Theme System
Drupal 7 Theme System
 
Drupal theming
Drupal themingDrupal theming
Drupal theming
 
Drawing the Line with Browser Compatibility
Drawing the Line with Browser CompatibilityDrawing the Line with Browser Compatibility
Drawing the Line with Browser Compatibility
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
Creating Themes
Creating ThemesCreating Themes
Creating Themes
 
Writing PHP – The WordPress Way! by Rahul Bansal @WordCamp Mumbai 2017
Writing PHP – The WordPress Way! by Rahul Bansal  @WordCamp Mumbai 2017Writing PHP – The WordPress Way! by Rahul Bansal  @WordCamp Mumbai 2017
Writing PHP – The WordPress Way! by Rahul Bansal @WordCamp Mumbai 2017
 
WordPress Theme Development
WordPress Theme DevelopmentWordPress Theme Development
WordPress Theme Development
 
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) BootstrapАндрей Юртаев - Improve theming with (Twitter) Bootstrap
Андрей Юртаев - Improve theming with (Twitter) Bootstrap
 
Intro to WordPress theme development
Intro to WordPress theme developmentIntro to WordPress theme development
Intro to WordPress theme development
 

Similar to Theme like a monster #ddceu

Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
Emma Jane Hogbin Westby
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009
Emma Jane Hogbin Westby
 
Functional FIPS: Learning PHP for Drupal Theming
Functional FIPS: Learning PHP for Drupal ThemingFunctional FIPS: Learning PHP for Drupal Theming
Functional FIPS: Learning PHP for Drupal Theming
Emma Jane Hogbin Westby
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Nguyen Duc Phu
 
Custom elements - An alternate Render API for decoupled Drupal
Custom elements - An alternate Render API for decoupled DrupalCustom elements - An alternate Render API for decoupled Drupal
Custom elements - An alternate Render API for decoupled Drupal
nuppla
 

Similar to Theme like a monster #ddceu (20)

Grok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb updateGrok Drupal (7) Theming - 2011 Feb update
Grok Drupal (7) Theming - 2011 Feb update
 
Drupal Front End PHP
Drupal Front End PHPDrupal Front End PHP
Drupal Front End PHP
 
Forensic Theming - DrupalCon London
Forensic Theming - DrupalCon LondonForensic Theming - DrupalCon London
Forensic Theming - DrupalCon London
 
Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009Learning PHP for Drupal Theming, DC Chicago 2009
Learning PHP for Drupal Theming, DC Chicago 2009
 
Functional FIPS: Learning PHP for Drupal Theming
Functional FIPS: Learning PHP for Drupal ThemingFunctional FIPS: Learning PHP for Drupal Theming
Functional FIPS: Learning PHP for Drupal Theming
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011
 
Drupal7 Release Party in Luxembourg
Drupal7 Release Party in LuxembourgDrupal7 Release Party in Luxembourg
Drupal7 Release Party in Luxembourg
 
The Themer's Toolkit
The Themer's ToolkitThe Themer's Toolkit
The Themer's Toolkit
 
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCRDrupal7 Theming session on the occassion of  Drupal7 release party in Delhi NCR
Drupal7 Theming session on the occassion of Drupal7 release party in Delhi NCR
 
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
Deliverance: Plone theming without the learning curve from Plone Symposium Ea...
 
Introduction to rails
Introduction to railsIntroduction to rails
Introduction to rails
 
Drupal Render API
Drupal Render APIDrupal Render API
Drupal Render API
 
Seven deadly theming sins
Seven deadly theming sinsSeven deadly theming sins
Seven deadly theming sins
 
i18n for Plugin and Theme Developers, Global WordPress Translation Day 3
i18n for Plugin and Theme Developers, Global WordPress Translation Day 3i18n for Plugin and Theme Developers, Global WordPress Translation Day 3
i18n for Plugin and Theme Developers, Global WordPress Translation Day 3
 
How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP framework
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
 
RoR (Ruby on Rails)
RoR (Ruby on Rails)RoR (Ruby on Rails)
RoR (Ruby on Rails)
 
Custom elements - An alternate Render API for decoupled Drupal
Custom elements - An alternate Render API for decoupled DrupalCustom elements - An alternate Render API for decoupled Drupal
Custom elements - An alternate Render API for decoupled Drupal
 
Turbogears Presentation
Turbogears PresentationTurbogears Presentation
Turbogears Presentation
 
Keeping the fun in functional w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional   w/ Apache Spark @ Scala Days NYCKeeping the fun in functional   w/ Apache Spark @ Scala Days NYC
Keeping the fun in functional w/ Apache Spark @ Scala Days NYC
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
 
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
 

Recently uploaded (20)

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 - 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
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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 ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
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
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 

Theme like a monster #ddceu

  • 1. june 2 0 1 1 THEME LIKE A MONSTER MAREK SOTAK | ATOMIC ANT www.atomicant.co.uk
  • 2. OH HAI! ABOUT ME & ATOMIC ANT ● Web designer, developer ● Over 5 years with Drupal - since v4.6 ● International team ● active in Drupal community - rootcandy, organising events @sotak -- http://sotak.co.uk - http://atomicant.co.uk
  • 3. DREAM JOB! NOT REALLY ● They've called in ● Job I didn't really want to do ● Little tweaks, that's what they've said
  • 7. OH WELL OH YEAH ● theme in /themes folder ● multisite approach? no? - http://drupal.org/node/53705
  • 8. OH WELL OH YEAH ● cloning Garland (any contrib theme - how to) ● you better sub-theme! - http://drupal.org/node/225125
  • 9. LIKE A SHERLOCK OH YEAH ● Ctrl+U, browsing the theme's folder, wait...
  • 10. LIKE A SHERLOCK OH YEAH ● 109 files? structure? Problem?
  • 12. THAT MOMENT NIGHTMARE NO. 1 ● How many libraries you have? Sorry? ● elmstreet.info jsearchbox.js - custom js, copied? a js function getElementsByClassName?
  • 13. HARDCODED NIGHTMARE NO. 2 ● hardcoded <link>s and <script>s <head> <?php print $head ?> <title><?php print $head_title ?></title> <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() . path_to_theme();?>/common.css?G" /> <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() . path_to_theme();?>/style.css?G" /> <link type="text/css" rel="stylesheet" media="all" href="<?php echo base_path() . path_to_theme();?>/pc-menu.css?G" /> <?php print $scripts ?> </head>
  • 14. HARDCODED NIGHTMARE NO. 2 ● no $styles variable? ● how about drupal/modules css? ● aggregation? ● exception hardcoded link - conditional stylesheets ● want to remove styles? do it in .info file stylesheets[all][] = system-menus.css hook_css_alter();
  • 15. $CLOSURE NIGHTMARE NO. 3 ● page.tpl.php </div> <?php require_once($_SERVER['DOCUMENT_ROOT'] ."/themes/elmstreet/google_analytics.php"); ?> </body> </html> ● oh, you already have google analytics module?
  • 16. C A M P B L O O D F R I D A Y 1 3 th NIGHTMARE NO. 4 ● template.php ● Copy, paste but THINK!
  • 17. C A M P B L O O D F R I D A Y 1 3 th NIGHTMARE NO. 4 ● functions like garland_xxx - leftovers ● custom functions get_user(), groupdetails(),... ○ _mytheme_get_user(), mytheme_groupdetails()
  • 19. FORM API MISUSE NIGHTMARE NO. 6 ● Oh Hai "elmstreet_mysearchform" in template.php ● FAPI syntax, returns form array - but where is this being called from? ● in page.tpl.php via drupal_get_form?
  • 20. UNEXPLAINABLE NIGHTMARE NO. 7 ● Remember? ● So they probably wanted to have a template suggestions for specific pages incl. headers
  • 21. UNEXPLAINABLE NIGHTMARE NO. 7 <?php $nodenid = $node->nid; ?> <?php if ($nodenid == '142') { include('page_mpffe.tpl.php'); return; } ?> <?php if ($nodenid == '131') { include('page_sca.tpl.php'); return; } ?> <?php if ($override == 'mpffe') { include('page_mpffe_other.tpl.php'); return; } ?> <?php if ($override == 'sca') { include('page_sca_other.tpl.php'); return; } ?> <?php if ($override == 'cppce') { include('page_cppce_other.tpl.php'); return; } ?> <?php if ($override == 'ankpg') { include('page_ankpg_other.tpl.php'); return; } ?>
  • 22. UNEXPLAINABLE NIGHTMARE NO. 7 ● we have custom suggestions ○ D6 - template_files, template_file ○ D7 - $variables['theme_hook_suggestions']
  • 24. QUESTIONS GOT ANY NIGHTMARES? twitter: @sotak http://sotak.co.uk http://atomicant.co.uk