Hi, i have spent like hours trying to find some good doc and im still confused.
What im looking at is a view with a few fields: title, teaser, attachments and some cck fields like price etc.
What i want to create is a table that will show an image (first of many attached images) then in second column title and teaser below it. Just like a simple product catalog list.
I was looking at table and list styles and i found that i can build template files like views-view-table--products.tpl.php and inside i could build entire table if i want.
BUT! ... and here is the hard bit. How on earth can i get all those information i need. First of all i dont know what variables are registered and how can i extrace desired info. I tried printing func_get_args() to reverse enginere it a bit but it sucks ;-)
For example if i use attachment as image then i get list of some preprocessed objects and not only its huuuuuge but i dont know what are the variable names nor how to get to the link url etc. Id hope to say something like:
img src='.$fields['attachments'][0]['url'].' alt='.$fields['attachments'][0]['title'].'.....
So i was thinking maybe there is a way to intercept the table of arguments before its passed to the view template file? then i could add some values like i would load the node and extract things i need and add them somehow to the arguments array. Or am i on the wrong way to get there?
if i would know how those functions should be named and what will i get as arguments and how to return it ... then i should be ok :- )
Thanks a million!
Comments
This link might be helpful
How to theme views
did not work
Yes i have gone through that but still was not able to create my functions. they are just not called or im doing something wrong there.
Do i have to register those functions somehow or whats the naming convention? .... im just confused.
I also dont know if thats the way to go? or should i do it in some theme function or in template file etc. also if i go with template files do i have to override all of them like field/row/table? or can i just make one table override and render everything there?
btw. is the doc you sent for drupal 5 and 6 ? im using 6.8.
thanks a lot
Art
--------
http://artur.ejsmont.org
Hi, Try flushing the data
Hi,
Try flushing the data cache if you're on drupal6, theme info is cached in drupal 6 so you need to flush it before it will see your new template.
Go to Site configuration > Performance > click the Clear cached data button at the bottom, hopefully that should do it.
Cheers
Tom
______________________________________________
What to get a Drupaler for Xmas - http://drupalsn.com/node/2659
______________________________________________
https://tomswebstuff.com
The best d6 views
The best d6 views documentation is available from the module itself if you have the advanced_help module also installed. Also, clicking on the "Theme: information" link in the basic settings box of your view will provide valuable info as well (click on the individual links for sample code) and there's a "Rescan template files" button right there for detecting template changes.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
FINALLY!
Oh dear god!
The problem was that i copied garland and did not rename folder nor info file to the theme name. I have just modified theme name in the info file so wrong callbacks were being searched for!
btw i found a lot of info on theming in drupal 6 as the doc on the drupal site is out of date.
So finally my function can be named like:
function mytheme_views_view_table__productsview (...
These should help a lot:
http://www.agileapproach.com/blog-entry/theming-views-drupal-6
http://www.group42.ca/theming_views_2_the_basics
http://views.doc.logrus.com/views-view_8tpl_8php.html
http://views.doc.logrus.com/views-view-fields_8tpl_8php.html
thanks for hints :- )
Art
--------
http://artur.ejsmont.org