K
K
Karen Kratyan2015-09-21 13:33:58
Drupal
Karen Kratyan, 2015-09-21 13:33:58

How to programmatically disable themes/templates, header, footer in Views and pass data to the theme/template?

I programmatically get views:

$view = views_get_view('myview');
$view->set_display('my_display');
$view->pre_execute();
$view->execute();
$output = $view->render();

By the way, is the sequence of function calls correct?
And questions:
1. How to get the output without style template defined: display(views-view.tpl.php), style(views-view-unformatted.tpl.php)?
2. How to pass data (variable) to the template? For example, in views-view.tpl.php.
3. How to properly disable header, footer? Not in the views-view template - by removing the code. Is it right?
$view->header = array();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question