Howto zu views-view--[dein_views_mashinename].tpl.php gesucht
am 26.11.2014 - 17:19 Uhr in
Hallo,
mir wurde eine Website übergeben, bei der knapp 20 views-view-field--[dein_views_mashinename].tpl.php existieren.
Beispielsweise 'views-view-fields--projekte--page.tpl.php':
<?php
/**
* This template is used to print a single field in a view. It is not
* actually used in default Views, as this is registered as a theme
* function which has better performance. For single overrides, the
* template is perfectly okay.
*
* Variables available:
* - $view: The view object
* - $field: The field handler object that can process the input
* - $row: The raw SQL result that can be used
* - $output: The processed output that will normally be used.
*
* When fetching output from the $row, this construct should be used:
* $data = $row->{$field->field_alias}
*
* The above will guarantee that you'll always get the correct data,
* regardless of any changes in the aliasing that might happen if
* the view is modified.
*/
?><?php
$type = strip_tags($fields['type']->content, '<br>');
switch($type){
case 'Projekte' :
echo "<strong>";
print $fields['field_projektleiter_vorname']->content;
echo " ";
print $fields['field_projektleiter_name']->content;
print $fields['field_weitere_autoren']->content;
echo "</strong>, Forschungsprojekt: ";
print $fields['title']->content;
echo ". ";
print $fields['field_zusammenfassung']->content;
echo "<p> </p>";
break;
case 'Promotion' :
echo "<strong>";
print $fields['field_doktorand_vorname']->content;
echo " ";
print $fields['field_doktorand_name']->content;
echo "</strong>, Promotion: ";
print $fields['title']->content;
echo ". ";
print $fields['field_zusammenfassung']->content;
echo "<p> </p>";
break;
case 'Habilitation' :
echo "<strong>";
print $fields['field_habilitant_vorname']->content;
echo " ";
print $fields['field_habilitant_name']->content;
echo "</strong>, Habilitation: ";
print $fields['title']->content;
echo ". ";
print $fields['field_zusammenfassung']->content;
echo "<p> </p>";
break;
case 'Sonstige Publikationen' :
echo "<strong>";
print $fields['field_autor_vorname']->content;
echo " ";
print $fields['field_autor_nachname']->content;
print $fields['field_weitere_autoren']->content;
echo ":</strong> ";
print $fields['title']->content;
print $fields['field_fundstelle']->content;
if(strip_tags($fields['field_fundstelle']->content) != "") {
echo ". In: ";
print $fields['field_fundstelle']->content;
}
else{
if(strip_tags($fields['field_seite_von']->content) != "") {
echo ". In: ";
}
if(strip_tags($fields['field_titel_der_zeitschrift']->content) != "") {
print $fields['field_titel_der_zeitschrift']->content;
echo " ";
}
print $fields['field_ausgabe_nummer']->content;
echo ", ";
print $fields['field_jahr']->content;
if(strip_tags($fields['field_seite_von']->content) != "") {
echo ", S. ";
print $fields['field_seite_von']->content;
echo "-";
print $fields['field_seite_bis']->content;
}
print $fields['field_url']->content;
}
echo "<p> </p>";
break;
}
?>Wie kann ich sehen, wo o.g. Template zum Einsatz kommt?
- Anmelden oder Registrieren um Kommentare zu schreiben

Wenn schon der Views Name
am 26.11.2014 - 17:42 Uhr
Wenn schon der Views Name angegeben ist, solltest Du Dir diese Views mal genauer ansehen. In der rechten Spalte gibt es dort unten den Punkt Theme. Den mal anklicken und Du siehst, welche Templates im Einsatz sind.