Geekmas #4: cleaning up you act

5 December 2007 mortendk

#4 geekmas entry and im almost a day late *argh*
Well today its the wonderfull views modules turn, and a sweet way to make the source a bit more readable - yup cause all themers live half their life inside firebug.

The mighty Views modul have a habbit of telling each and every little div & li what classes they are, and for some this is a bit annoing, *sometimes* - but since this is mighty drupal we can change this in our template.php file (youtheme/template.php)

template.php:
I have commented out the original code, and added som spans instead, so I dont have to add {display:inline} to the divs.
So if you figures out that woops it wold be nice with an "view-label fieldname" class -its fast to add

#000000">#0000BB"><?php
#FF8000">//------------------------------------------------------------
//VIEWS
//------------------------------------------------------------
/* view elm  return a list with out all those style classes for easier  reading in the source*/
#007700">function #0000BB">phptemplate_views_view_list#007700">(#0000BB">$view#007700">, #0000BB">$nodes#007700">, #0000BB">$type#007700">) {
 
#0000BB">$fields #007700">= #0000BB">_views_get_fields#007700">();

  foreach (
#0000BB">$nodes #007700">as #0000BB">$node#007700">) {
   
#0000BB">$item #007700">= #DD0000">''#007700">;
    foreach (
#0000BB">$view#007700">->#0000BB">field #007700">as #0000BB">$field#007700">) {
      if (
#0000BB">$fields#007700">[#0000BB">$field#007700">[#DD0000">'id'#007700">]][#DD0000">'visible'#007700">] !== #0000BB">FALSE#007700">) {
        if (
#0000BB">$field#007700">[#DD0000">'label'#007700">]) {
#FF8000">//          $item .= "<div class='view-label ". views_css_safe('view-label-'. $field['queryname']) ."'>" . $field['label'] . "</div>";
         
#0000BB">$item #007700">.= #DD0000">"<div>" #007700">. #0000BB">$field#007700">[#DD0000">'label'#007700">] . #DD0000">"</div>"#007700">;
        }
#FF8000">//        $item .= "<div class='view-field ". views_css_safe('view-data-'. $field['queryname']) ."'>" . views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view) . "</div>";
         
#0000BB">$item #007700">.= #DD0000">"<span>" #007700">. #0000BB">views_theme_field#007700">(#DD0000">'views_handle_field'#007700">, #0000BB">$field#007700">[#DD0000">'queryname'#007700">], #0000BB">$fields#007700">, #0000BB">$field#007700">, #0000BB">$node#007700">, #0000BB">$view#007700">) . #DD0000">"</span>"#007700">;
      }
    }
#FF8000">//    $items[] = "<div class='view-item ". views_css_safe('view-item-'. $view->name) ."'>$item</div>\n"; // l($node->title, "node/$node->nid");
     
#0000BB">$items#007700">[] = #DD0000">"$item\n"#007700">; #FF8000">// l($node->title, "node/$node->nid");
 
#007700">}
  if (
#0000BB">$items#007700">) {
    return
#0000BB">theme#007700">(#DD0000">'item_list'#007700">, #0000BB">$items#007700">);

  }
}
#0000BB">?>

...only 5 mmm 4 days til im turning 34 *damn

The content of this field is kept private and will not be shown publicly.
@codingdesigner @chriscoyier off course it wins its powered by #teamsass ;) 35 min 49 sec ago
3,785

DrupalCon Denver 2012 - I am a Speaker!

good Stüff

Mothership - a clean up the crap "theme"

Miro - a open atrium theme:
more info & comments

freya rocks

the progress for my premature daughter can be folllowed here:
Freya Rocks
sorry its in danish

Give some Love to the development of the mothership

Flattr this

User login

Recent comments

give some luv

drupal member ...

geek royale