wizard di views

10 contenuti / 0 new
Ultimo contenuto
wizard di views

ciao,
volevo cambiare l' html di una vista in pratica mettere le anteprime delle foto inline e magari modificare il contorno o altri effetti tramite css, pensavo di utilizzare il suo wizard di views ma! dopo aver inserito il codice come dice il wizard nel file template.php del mio tema, creato il file views_nome.tpl.php e creato il file .css, dopo aver provato e riprovato più volte la vista non cambia, qualcuno sa come si fa e se funziona?
o altra soluzione per cambiare l'aspetto della vista creata?

Provato svuotando le cache ?

si dal tools di views, niente!

  1. Hai messo il tpl.php nella cartella del tuo tema?
  2. Hai fatto ricaricare l'elenco dei file del tema?
  3. Il CSS che hai inserito, l'hai aggiunto nel fiel info del tema?

Ciao
Marco
--
My blog
Working at @agavee

scusa mavimo,ho dimenticato non è la 6.x ma Drupal 5.15
ho fatto così:
nella cartella del mio tema, nel file template.php ho aggiunto questo:

/**
* views template to output a view.
* This code was generated by the views theming wizard
* Date: Gio, 29/01/2009 - 11:11
* View: prova_vista
*
* This function goes in your template.php file
*/
function phptemplate_views_view_list_prova_vista($view, $nodes, $type) {
  $fields = _views_get_fields();
  $taken = array();
  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }
  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );
  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views-list-prova_vista', $vars);
  }
  if ($items) {
    return theme('item_list', $items);
  }
}

poi ho creato questo file views-list-prova_vista.tpl.php:
<?php
/**
 * views template to output one 'row' of a view.
 * This code was generated by the views theming wizard
 * Date: Gio, 29/01/2009 - 11:11
 * View: prova_vista
 *
 * Variables available:
 * $view -- the entire view object. Important parts of this object are
 *   prova_vista, .
 * $view_type -- The type of the view. Probably 'page' or 'block' but could
 *   also be 'embed' or other string passed in from a custom view creator.
 * $node -- the raw data. This is not a real node object, but will contain
 *   the nid as well as other support fields that might be necessary.
 * $count -- the current row in the view (not TOTAL but for this page) starting
 *   from 0.
 * $stripe -- 'odd' or 'even', alternating. * $nid --
 * $nid_label -- The assigned label for $nid
 * $title -- Display the title of the node.
 * $title_label -- The assigned label for $title
 *
 * This function goes in your views-list-prova_vista.tpl.php file
 */
 //now we add the stylesheet...
 
drupal_add_css(path_to_theme() .'/views-list-prova_vista.css');
 
?>

<div class="view-label view-field-nid">
  <?php print $nid_label ?>
</div>
<div class="view-field view-data-nid">
  <?php print $nid?>
</div>
<div class="view-label view-field-title">
  <?php print $title_label ?>
</div>
<div class="view-field view-data-title">
  <?php print $title?>
</div>
e per ultima cosa il file views-list-prova_vista.css :
/* *
* views template to output the stylesheet to customize a view.
* This code was generated by the views theming wizard
* Date: Gio, 29/01/2009 - 11:11
* View: prova_vista
*
* The class selectors are filled with a single comment line.
* You should complete each selector according to your liking.
*/
.view-label {
/* insert your css code for this element here */
}
.view-field {
/* insert your css code for this element here */
}
.view-field-nid {
/* insert your css code for this element here */
}
.view-data-nid {
/* insert your css code for this element here */
}
.view-field-title {
/* insert your css code for this element here */
color= red;
fontsize = 30px;
}
.view-data-title {
/* insert your css code for this element here */
}

ho provato a inserire colore rosso e font grande ma niente, feci una ricerca... non ricordo dove ho letto, forse su drupal.org, ho provato a cambiare il nome della funzione da:
function phptemplate_views_view_list_prova_vista($view, $nodes, $type) {
  $fields = _views_get_fields();
...
$items[] = _phptemplate_callback('views-list-prova_vista', $vars);
  }
  if ($items) {
    return theme('item_list', $items);
  }

in
function miotema_views_view_list_prova_vista($view, $nodes, $type) {
  $fields = _views_get_fields();
...
$items[] = _miotema_callback('views-list-prova_vista', $vars);
  }
  if ($items) {
    return theme('item_list', $items);
  }

sono esausta... ???

ci siamo quasi, devi andare ad usare drupal_add_css per far caricare il tuo css, nulla di più =)

Ciao
Marco
--
My blog
Working at @agavee

scusa sarà l'ora... ma non ti seguo,
il nome della funzione va cambiato con il nome del tema?

Quote:
ci siamo quasi, devi andare ad usare drupal_add_css per far caricare il tuo css, nulla di più =)

devo andare ad usare drupal_add_css, dove? non è già presente nel file views-list-prova_vista.tpl.php

si, ma viene aggiunto nella pagina?

Ciao
Marco
--
My blog
Working at @agavee

no, non viene aggiunto! ho provato a forzarlo mettendo in template.php:

drupal_add_css(path_to_theme() .'/views-list-prova_vista.css');

in c'è

1@import "/sites/all/themes/barlow/views-list-wiz.css";

... niente non cambia nulla, non so se arrendermi, provo ancora un pò e poi cambio strada ...

Ciao,
io ho lo stesso problema.

mavimo wrote:

  1. Hai messo il tpl.php nella cartella del tuo tema?
  2. Hai fatto ricaricare l'elenco dei file del tema?
  3. Il CSS che hai inserito, l'hai aggiunto nel fiel info del tema?

  1. Si
  2. come?
  3. No, non basta il codice "add" nel file tpl?

Sembra proprio che non venga considerato quel file tpl creato :(