Views 3 : Set header/footer/empty text for view via views_embed_view I update my views from views 2 and I do the same on embedded code. But actually I can't set footer content as it changes in views 3.

My views 2 code :

$emptyTextVue = $view-&gt;display_handler-&gt;get_option('empty');
$emptyText = $view-&gt;display_handler-&gt;set_option('empty','&lt;div class="ma-classe"&gt;Pas images.&lt;/div&gt;');


I think I do use the export code like :

$handler-&gt;display-&gt;display_options['empty']['area']['content'] = 'Pas d\'images à afficher.';


but how ?

EDIT : extract result for var_dump() : ["handler_type"]=&gt; string(5) "empty" ["options"]=&gt; array(11) { ["id"]=&gt; string(4) "area" ["table"]=&gt; string(5) "views" ["field"]=&gt; string(4) "area" ["relationship"]=&gt; string(4) "none" ["group_type"]=&gt; string(5) "group" ["ui_name"]=&gt; string(0) "" ["label"]=&gt; string(13) "Zone de texte" ["empty"]=&gt; int(0) ["content"]=&gt; string(25) "Pas d'images à afficher." ["format"]=&gt; string(1) "2" ["tokenize"]=&gt; int(0) } ["definition"]=&gt; array(4) { ["handler"]=&gt; string(23) "views_handler_area_text" ["group"]=&gt; string(6) "Global" ["title"]=&gt; string(13) "Zone de texte" ["help"]=&gt; string(33) "Provide markup text for the area." } ["is_handler"]=&gt; bool(true) ["localization_keys"]=&gt; array(4) { [0]=&gt; string(7) "default" [1]=&gt; string(5) "empty" [2]=&gt; string(5) "views" [3]=&gt; string(4) "area" } ["table"]=&gt;
First up, don't use views_embed_view(). It is a very simple function that doesn't allow for customisation.

Do something like this:



// Load the view.
$view = views_get_view('VIEW_NAME');
// Set the options for the header text.
// To get an idea of what options are available, set up a view with header text
// and then use the devel module to print out the view definition.
// For example, add a header text area field and print it with
// dpm($view-&gt;header['area']); after you have loaded it with views_get_view().
$header_options = array(
  'label' =&gt; t('Header text'), // Administrative label. Not really needed here.
  'content' =&gt; 'This is the header text content.', // Content of header text.
  'format' =&gt; 'filtered_html', // Format of header text.
  'empty' =&gt; 1, // Show even when there are no results. Set to zero otherwise.
);
// This adds a header handler for a text area. The table is views because it is not
// a database field. The field is area because it is a text area.
// The header_options are the settings.
$view-&gt;add_item('DISPLAY_NAME', 'header', 'views', 'area', $header_options);
// This is the preferred way to get the rendered view.
$output = $view-&gt;preview('DISPLAY_NAME');
// If you want you can check for results with this.
if (!empty($view-&gt;result)) {
  // Do something if there are rows.
}


You can do the same for footer handlers:

$view-&gt;add_item('DISPLAY_NAME', 'footer', 'views', 'area', $footer_options);


and empty text:

$view-&gt;add_item('DISPLAY_NAME', 'empty', 'views', 'area', $empty_options);


You can also change the field type if you don't want to use Global: Text area.

For more information see $view->add_item()