By vrsotto on
hello,
how can i customize(theme) views output, removing or inserting some extra tags (Html)?
any idea i very much appreciated.
thanks,
vsotto
hello,
how can i customize(theme) views output, removing or inserting some extra tags (Html)?
any idea i very much appreciated.
thanks,
vsotto
Comments
Have a look in
Have a look in sites/all/modules/views. You’ll find some *.tpl.php files there. You can copy these to your theme to override them.
you mean in
you mean in sites/all/modules/views/theme?
Ah yes, some modules put them
Ah yes, some modules put them in a subdirectory.
thanks, i will look into
thanks, i will look into this...
Inside of your views there is
Inside of your views there is Basic Settings > Theme : Information.
Clicking the Information will display all the possible templates.
thanks for this additional
thanks for this additional info...
ok, i'm having a little hard
ok, i'm having a little hard time trying to accomplished what i wanted to have :)
in the code bellow...
need to output something like...
and among other fields...
what are the tweaking needed to be done? i don't get much understand what the devel.module is giving me :)
please help...
I just like to share how I
I just like to share how I remove some unnecessary or extra html tags of “Views 2” output. The idea here might not good enough (base on my understanding), but it basically achieved what I wanted. For newbie’s like me, it may be nice to read first this section (http://drupal.org/node/352970).
Note: I theme the general output of views for testing
Basically, I wanted to output a block (generated by views) that will display title, teaser, link (to actual node), and comment link (for user/ site visitor post some comment).
So the fields are (I just skip some setup of my views block)
Node: Title
Node: Teaser
Node: Link
Comment: Node link
The default Views output, the code would look something like…
What I did, is copied templates views-view.tpl, views-view-unformatted.tpl, and views-view-fields.tpl from “sites/all/modules/views/theme” and paste into my “theme” folder (under subfolder views). From there I modified those templates.
and the resulting html codes...
i think its clean enough, right!!? :)
i hope this gives an idea for newbie's like me who are struggling understanding drupal.
many thanks for those who shared ideas... :)
vsotto
That's really great thanks.
That's really great thanks. Is there a tutorial for advanced editing of these files?
hi there, i'm not sure what
hi there, i'm not sure what do you mean by "advanced editing" but, try to see the links bellow if you find something interesting
Links:
http://www.group42.ca/theming_views_2_the_basics
http://www.drupaler.co.uk/blog/theming-views-drupal-6x/67
this website (http://mustardseedmedia.com) is so informative
=============================================
http://mustardseedmedia.com/podcast/episode9
http://mustardseedmedia.com/podcast/episode23
http://mustardseedmedia.com/podcast/episode30
i hope you find something useful here...
thanks,
vsotto
How about for content types (nodes) created with CCK?
Works great for Views, but do you have any idea how to do the same for custom content types created with CCK? Even when you create a node-customtype.tpl.php a lot of junk from CCK is inserted.
i followed this
i followed this http://drupal.org/node/266817 thread and it helps me a lot... also, i would recommend you to install devel.module and firebug for your browser
hope this would help you too...
subscribing!!
subscribing!!
---~~~***~~~---
aac
Subscribing too!
Also subscribing, I'm also looking to eliminate the crufty tags around the views output.
just follow the above
just follow the above example(code)... given you wanted to have a views of type "block" name "story" that should return an output for: Title, Teaser, Link, and comment as fields.
from the views module template files found on your drupal installation, sites/all/modules/views/theme, copy and paste into your theme folder then rename:
just play around with those templates... and you'll soon figured it out what variable generates certain codes.
hope this may help...
vsotto
Thanks for the in depth
Thanks for the in depth explanation. I am trying to change the output of my view and this will come in handy. For some reason, the view is outputting a target_self attribute on the link to the node which isn't xhtml compliant. I didn't write it or select it in the view section. I'll give this a go and see if I can get this to work.
Thank you!
i'm glad you find this post
i'm glad you find this post handy... and good luck!