3

I have a view called sabk__view whose path is /sabk. It has a page display mode. I created a page named page--sabk.tpl.php in order to display the content of view, but I don't know what code displays the content of view.

I also checked modules/system/page.tpl.php to see if there is any useful variable (e.g. print render($content)), but none of them displayed anything about view.

How can I display view's output in a specific <div> tag? Do I need to implement <theme>_preprocess_node?

I am using Drupal 7, if that makes any difference.

3 Answers 3

3

I use the following function to solve the issue

print views_embed_view('NAME_OF_VIEW','page');
2

Under view's advanced option there will be a option called as theme. Click on that. This will display the template files associated with views.

You need to copy that file and place in your template folder with any one of the names.

Try to clear cache/ rescan templates.

2
  • I've already done this before. this is one of the names it suggested: views-view--sabk--view.tpl.php ;so now I must delete page--ViewName.tpl.php file? in views-view--sabk--view.tpl.php I entered this code <?php print "hi"; ?> it displayed nothing but page--ViewName.tpl.php page.
    – M a m a D
    Commented Sep 21, 2013 at 6:49
  • Try using devel_themer module, it will sort you from which template the views page is rendered. In that template you can add the needed div.
    – Gladiator
    Commented Sep 23, 2013 at 12:50
2

It's a ds_extras module in the package Display Suit. It has a secret part, you have to turn on: admin/structure/ds/list/extras > Other > Views displays

Than you can add any views to render by ds: admin/structure/ds/vd, so you have close to full control over the html output of view.

1
  • So you mean there is no way out to display views output?
    – M a m a D
    Commented Sep 21, 2013 at 11:48

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.