• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Theme like a monster #ddceu
 

Theme like a monster #ddceu

on

  • 1,856 views

Based on the blog posts Drupal theming nightmares at http://sotak.co.uk/blog

Based on the blog posts Drupal theming nightmares at http://sotak.co.uk/blog

Statistics

Views

Total Views
1,856
Views on SlideShare
1,358
Embed Views
498

Actions

Likes
1
Downloads
5
Comments
0

2 Embeds 498

http://cocoate.com 400
http://www.linkedin.com 98

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Theme like a monster #ddceu Theme like a monster #ddceu Presentation Transcript

    • june 2 0 1 1THEME 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 ● Theyve called in ● Job I didnt really want to do ● Little tweaks, thats what theyve said
    • DREAM JOB!NOT REALLY
    • DREAM JOB!NOT REALLY
    • DREAM JOB!NOT REALLY
    • OH WELLOH YEAH ● theme in /themes folder ● multisite approach? no? - http://drupal.org/node/53705
    • OH WELLOH YEAH ● cloning Garland (any contrib theme - how to) ● you better sub-theme! - http://drupal.org/node/225125
    • LIKE A SHERLOCKOH YEAH ● Ctrl+U, browsing the themes folder, wait...
    • LIKE A SHERLOCKOH YEAH ● 109 files? structure? Problem?
    • LIKE A SHERLOCKOH YEAH
    • THAT MOMENTNIGHTMARE NO. 1 ● How many libraries you have? Sorry? ● elmstreet.infojsearchbox.js - custom js, copied? a js function getElementsByClassName?
    • HARDCODEDNIGHTMARE 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>
    • HARDCODEDNIGHTMARE 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();
    • $CLOSURENIGHTMARE 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 thNIGHTMARE 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 thNIGHTMARE NO. 4 ● functions like garland_xxx - leftovers ● custom functions get_user(), groupdetails(),... ○ _mytheme_get_user(), mytheme_groupdetails()
    • SQL QUERIESNIGHTMARE NO. 5 JUST DONT
    • FORM API MISUSENIGHTMARE 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?
    • UNEXPLAINABLENIGHTMARE NO. 7 ● Remember? ● So they probably wanted to have a template suggestions for specific pages incl. headers
    • UNEXPLAINABLENIGHTMARE 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; } ?>
    • UNEXPLAINABLENIGHTMARE NO. 7 ● we have custom suggestions ○ D6 - template_files, template_file ○ D7 - $variables[theme_hook_suggestions]
    • OKAYCONCLUSION
    • QUESTIONSGOT ANY NIGHTMARES?twitter: @sotakhttp://sotak.co.ukhttp://atomicant.co.uk