Hi!

I created a view, but I don't know how to specify a template for this view. My view consists of a name, title, headline, and main content. How can I access those elements of my view, when creating a template?

Thanks for your help!

Comments

marcoka’s picture

you want to have an other output? i needed to create the output of my view like this:

function zen_views_view_list_Gallery($view, $nodes, $type) { ...

Jeff Burnz’s picture

Enable the Views Theme Wizard module, a new tab will appear in Views - "Theme Wizard", click that and select your view, then "Simple List" and click "Select Theme Type" - follow the instructions from there - it will generate the a tpl file for your view, e.g. views-list-myview.tpl.php, and some code to place in your template.php file. It will also generate a css file.

In the tpl file you can strip out all the html if you want, and get rid of all the "labels" if you dont want them - use whatever html you want to layup the view.

One thing you'll find is that because its a list, it will come in <ul><li></li></ul> , a real pain for most views...

What i do is this - in the code that goes in template.php, right near the end you'll see this line:
return theme('item_list', $items);

Just replace it with this and say goodbye to that pesky list markup...
return implode("", $items);

Good luck!

math_1048’s picture

thank you very much dear for this solution
but I get it work with view as page
otherwise doesnt work with view as block ):
are there solution for is issue?
best regards

derekwebb1’s picture

Hello, you can also try Active Template for customizing your views. Active Template is like ConTemplate except it is for use with views.

Active Template works with both block and page views. Furthermore, you can have multiple templates for any given view and access them independently. Unlike ConTemplate, Active Template allows easy integration of JavaScript/jQuery, and CSS in the same view template editor so that creating custom view templates REALLY easy.

Regards, Derek
http://collectivecolors.com

math_1048’s picture

Thank you for help, its really great module
best regards