Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2009 at 06:44 UTC
Updated:
13 Dec 2012 at 10:30 UTC
I have one view where I want to only output the actual output without any wrapping divs or spans. I've tried to do so by overriding the theme without luck. Anyone who has a good suggestion on how to do it?
Comments
Comment #1
dawehner1) You could do this by using theming, and remove everything which is not needed from the template files.
For example the views-view.tpl.php would be reduced to:
Comment #2
NeoID commentedHi, thanks, but I've tried that, but it's still printing the divs (after changing the theme in views and clearing the cache) it's still adding the span and div around the output... :/
<?php print $rows; ?>still prints div and spans...Output now:
I need:
sites/..../files/wallpapers/wallpaper1.jpgComment #3
dagmar@NeoID: Please take a look at #269319: How to theme CCK field with a content-field-my_field.tpl.php file you need to change something that is out of the scope of views.
Comment #4
seutje commentedthe UI is your friend -> http://gyazo.com/4553cb82e5c530908de75587ca99d7ed.png -> http://gyazo.com/64e3abbc478bed55270084a52514491e.png
Comment #5
NeoID commented@seutje: It still doesn't remove the innermost div and span...
Comment #6
seutje commentedguess u also have to override content-field.tpl.php
Comment #7
merlinofchaos commented"The innermost div and span"
Since none of us are looking at your content, we have no idea of knowing which div and span this actually is. There are several potential themes that you need to override in order to remove all markup. Please see the theme: information page for which ones you can theme in Views. If those theme functions don't do it, then the markup isn't in Views or cannot be overridden.
Comment #8
NeoID commentedTherefor I pasted my current output in post 2.
What I struggle are those wrappers:
Comment #9
merlinofchaos commentedviews-field is provided by the field template within views. Override views-field.tpl.php to get rid of that.
field-content is provided by CCK. You'll have to check there for solutions.
Comment #10
NeoID commentedThanks a lot merlinofchaos and all others helping me out!
After creating three themes overrides it finally works! :)
Comment #11
seutje commentedu might be interested in the Mothership basetheme, it's pretty hardcore at removing wrappers
Comment #13
stewie32 commentedHow did you solve this problem. I am having the same issue
Comment #14
NeoID commented@Stewue32:
I used the following in my tpl.php file for the view:
<?php if ($rows): ?><?php print $rows; ?><?php elseif ($empty): ?><?php print $empty; ?><?php endif; ?>Hope that helps. :)
Comment #15
stewie32 commented@NeoID:
Thanks for the quick response. It's still not working for me though. I copied the views-view-field.tpl.php and renamed it appropriately views-view--view name.tpl into my theme's folder and replaced its code with the code you recommended. I also tried copying over the views-view-unformatted.tpl.php (because my view is styled unformatted) and doing the same, but it still shows the div span wrapper tags.
Am i over writing the wrong views.tpl file?
Comment #16
NeoID commented@stewie32: Try this (in this example my view is 'user_wallpaper'):
Display output: views-view--user-wallpaper.tpl.php
<?php if ($rows): ?><?php print $rows; ?><?php elseif ($empty): ?><?php print $empty; ?><?php endif; ?>Style output: views-view-unformatted--user-wallpaper.tpl.php
<?php foreach ($rows as $id => $row): ?><?php print $row; ?><?php endforeach; ?>Row Style: views-view-fields--user-wallpaper.tpl.php
<?php foreach ($fields as $id => $field): ?><?php print $field->content; ?><?php endforeach; ?>Comment #17
stewie32 commentedThank you so much. works like a charm.
Comment #19
ClaudeS-1 commentedI found this documentation which helped me - I'm trying to remove formatting from a field that isn't in a view, but just in a node/page template.
http://api.drupal.org/api/drupal/modules--field--field.module/function/t...
Comment #20
passportgeek commented