Thank you for this fantastic module, it really helps creating clean html output. I noticed that when using the semantic style and row style in Views to make a class-free unordered list, that the final html source code (when for example viewing the source in a browser) has a lot of white space and line breaks between the views rows. For example I have up 5 line breaks between a

and

. It makes the html source overview chaotic. Is there anything that can be done about that?

Comments

Anonymous’s picture

Category: bug » task
Anonymous’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
DanH’s picture

@adr75

One way to do it...

- Go into the "semanticviews" module folder and remove some of the line breaks in semanticviews-view-fields.tpl.php

DanH’s picture

Actually, don't hack the semanticviews-view-fields.tpl.php file directly - better to override.

Override the semanticviews-view-fields.tpl.php file by copying it into your active theme folder and then remove the line breaks. You may need to clear cached data to see the changes. ( Administer > Site Configuration > Performance ---> Clear cached data )

jerdavis’s picture

This was causing me some grief for a couple of fields I wanted to have defined as spans and butting up against each other. For example if you have a name field and then a position field, and you want to output as such:

desired results:
  <span class="name">John Doe</span><span>, CEO</span>
   John Doe, CEO

results out of the box:
  <span class="name">                    John Doe  </span>        <span>          , CEO    </span>
  John Doe , CEO

I ended up rewriting the semanticviews-view-fields.tpl.php in a theme level override as such:

foreach ($fields as $id => $field) {
  // Output an element with any attributes if one is defined.
  if ($field->element_type) {
    print "<". $field->element_type . drupal_attributes($field->attributes) .">";
  }

  // Output a field label and it's own element if a label exists and has an element defined.
  if ($field->label) {
    if ($field->label_element_type) {
      print "<". $field->label_element_type . drupal_attributes($field->label_attributes) .">";
    }

    print $field->label;

    if ($field->label_element_type) {
      print "</". $field->label_element_type .">";
    }
  }

  // Output field contents.
  print $field->content;

  // Close the initial element.
  if ($field->element_type) {
    print "</". $field->element_type .">";
  }
}
mansspams’s picture

subscr.

inlikealion’s picture

bangpound, what would it take to get this pushed into a release? How can I help?

inlikealion’s picture

Status: Active » Needs review

Setting status to "needs review". The above 'patch' theme override gives me much better white space and hasn't appeared to blow anything up for me, either. Can anyone more knowledgeable chime in on the quality of the above code? Does it work for anyone else?

milesw’s picture

Works nicely for me.

mxmilkiib’s picture

working fine for myself, thanks jerdavis

mxmilkiib’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Same issue exists in 7.x. As above, converting the new template from PHP in HTML to HTML in PHP works again to remove whitespace.

Scyther’s picture

Issue summary: View changes
Status: Needs review » Postponed (maintainer needs more info)

Is this still a problem with the 7.x version of this module?

Scyther’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)