Download & Extend

Error message in display.inc after views2 to views3 update

Project:Views
Version:6.x-3.0
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

An error after the update from views 2 to views 3
Hi

i get this error after updating the views module..i think it's about including views via views_embed mtehod..so what do you think about ?

Invalid argument supplied for foreach() dans /var/www/drupal6/sites/all/modules/views/plugins/views_plugin_display.inc à la ligne 824.

thanks

Comments

#1

I had the same issue as well. Had to roll back to 6.x-2.16
That error came up when I was trying to create new nodes of a certain kind.

#2

Title:After update to Views 3 from views 2» Error message in display.inc after views2 to views3 update
Status:active» postponed (maintainer needs more info)

Maybe there is a problem in your views_embed_view code?

#3

Status:postponed (maintainer needs more info)» active

i think so, here is a sample of my used embed code :

<?php
$viewname_fl3
= 'Formations_lycee';
$view = views_get_view ($viewname_fl3);
$viewdisplay_fl3 = $view->set_display('block_3');
//$args_ldj1 = $view->set_arguments(array($node->nid));

$emptyTextVue = $view->display_handler->get_option('empty');
$emptyText = $view->display_handler->set_option('empty','<div class="ma-classe">TEXTE VIDE A MODIFIER.</div>');

//Exécution de le vue
$view->pre_execute();
$view->execute();

if (!empty(
$view->result)) {
 
// S'il y a un resultat on récupère le titre (ajoute tag h3, et le contenu)
 
$output = '<div id="MODIFIER"><h3 class="classe-h3">'.$view->get_title().'</h3>' .$view->preview($viewdisplay_fl3).'</div>';

 
//Affiche la vue si contenu
print $output;
}
//sinon affiche texte vide
elseif (empty($view->result)) {
   
//Formatage du texte vide,ajout du titre de la vue
    
$outputEmpty = '<div id="MODIFIER"><h3 class="classe-h3">'.$view->get_title().'</h3>'.$emptyText.'</div>';
    
$outputEmpty = '<div id="MODIFIER"><h3 class="classe-h3">'.$view->get_title().'</h3>'.$emptyTextVue.'</div>';
   
// drupal_set_message('$EmptyTextVue : '.$emptyTextVue.'status');
     //Affichage du texte vide
 
print $outputEmpty;
}
?>

but i don't see about foreach() argument..

#4

$emptyTextVue = $view->display_handler->get_option('empty');
$emptyText = $view->display_handler->set_option('empty','TEXTE VIDE A MODIFIER.');

This for example is wrong now, as the empty text are now a set of area handlers of which one can be your text.

#5

i know and i did post on this : http://drupal.org/node/1825822
but nobody help me and i don't find a fix...

#6

Category:bug report» support request

Let me show you something: http://wstaw.org/m/2013/01/14/issues.png

We have a handbook for how to write other (more dynamic kind of) area handlers, see http://drupalcode.org/project/views.git/blob/refs/heads/6.x-3.x:/help/ap...

Just put in your logic into a custom plugin.

In general, just be fair and wait ... if you need instant support you should better pay someone.

#7

i'm searching solution ,and i try to use exported code but i don't know which part of code to use in my custom code:

/* Pied de page: Global : Zone de texte */
$handler->display->display_options['footer']['text']['id'] = 'area';
$handler->display->display_options['footer']['text']['table'] = 'views';
$handler->display->display_options['footer']['text']['field'] = 'area';
$handler->display->display_options['footer']['text']['label'] = '';
$handler->display->display_options['footer']['text']['empty'] = FALSE;
$handler->display->display_options['footer']['text']['content'] = '<a class="lien_archive" href="/node/61">Voir les archives</a>';
$handler->display->display_options['defaults']['filters'] = FALSE;

#8

Please read the text I gave you. It explains how to make a dynamic text without logic in the embed code.

#9

ok i did read the handbook page and i don't understand why i can't use existing text area provide by views ?
if i well understand handbook : it explain how to add a new area handler in views UI ? so i do to provide content for this area via Views UI ? not programmatically ?

thanks

EDIT: i made a custom module with your example but it seem not to activate..strange , i include the .inc file in the module folder..am i wrong ?
then, once i get my custom area in views how can i use it in embed code ?

re-thanks

#10

last test :

<?php
$emptyText
=$view->$handler->display->display_options['empty']['area']['content'] = "texte empty embed_views code 2";
?>

but always break the page that embed in it...