0

Currently i have a view with the name:

name (String, 21 characters ) home_slideshow_mobile

At the same time this view content is displayed inside a block, which filename (tpl.php) should it have my template file to rewrite the content of this view?

Thanks a lot :)

3 Answers 3

1

You can have multiple templates for views like :

views-view--home-slideshow-mobile.tpl.php

if your display is a block, you can write it like this :

views-view--home-slideshow-mobile--block.tpl.php

then you have templates for views fields :

views-view-fields--home-slideshow-mobile.tpl.php

Templates for views format (like unformatted for example) :

views-view-unformatted--home-slideshow-mobile.tpl.php

If you want to alter the template of your block, you can declare a block.tpl.php like :

block--my-block-module--my-block-machinename.tpl.php

You can check all views template in the module views (in like sites/all/contrib/views/theme/...). You can copy the template and paste them in your theme and rename it to target your specific view.

2
  • What if instead of unformatted be an html list? which would be the name?
    – martinezjc
    Commented Sep 24, 2015 at 16:36
  • It would be html-list instead of unformatted I guess. I'm glad that worked for you ;-)
    – pbonnefoi
    Commented Sep 24, 2015 at 16:45
3

https://api.drupal.org/api/views/theme!theme.inc/group/views_templates/7

See the suggestion for views templates.

If You calling a view block in your custom tpl.php use echo views_embed_view('view_machine_name', 'block_1'); You can find out the display name by clicking the tab and check its name in the address bar of your browser: "#views-tab-block_1" gives you "block_1'.

1

In your views, you can get a theme suggestions by clicking Theme: information under Advanced settings of your view. It gives you suggestion for every field, view style etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.