Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › FAQ ›

D6: Ajaxify your website - all node and term views - completely

Eingetragen von quiptime (4972) am 23.06.2008 - 20:07 Uhr in
  • Allgemeines

Alle Node- und Term-Ansichten mit Ajax-Funktionalität anzeigen

Geht's noch?

Mit Drupal 6 seitenweite Ajax-Funktionalität bei der Anzeige von Nodes und Terms realisieren?

Ja, es geht ganz einfach.

Term-Ansichten

Immer wenn eine URL nach dem Schema /taxonomy/term/x angezeigt wird.

Node-Ansichten

Immer wenn eine URL nach dem Schema /node/x angezeigt wird.

Realisierung

Die Realisierung ist eine Einfache und wendet eine der generellen Funktionalitaeten von Views 2 an.

  1. Für die Anzeige der Terms muss lediglich die bereits vorhandene Ansicht "taxonomy_term" aktiviert und für Ajax konfiguriert werden.
    Diese Ansicht hört auf alle URLs nach dem Schema /taxonomy/term/%. Wobei % als Argument die jeweils aktuelle Term ID einer URL ist.
  2. Für die Anzeige der Nodes wird analog der Ansicht für die Taxonomie eine Ansicht für die Nodes erstellt.
    Diese Ansicht hört auf alle URLs nach dem Schema /node/%. Wobei % als Argument die jeweils aktuelle Node ID einer URL ist.

Das ist eigentlich schon Alles was man tun muss um eine seitenweite Ajax-Funktionalität bei der Anzeige von Nodes und Terms zu realisieren.

Anhang

Als "Anhang" habe ich für beide Ansichten den Code zum Importieren als Ansicht beigefügt.

Die Ansicht "taxonomy_term" ist um die RSS Feedfunktionalität erweitert. Nach dem Import sollte die bereits existierende Ansicht gelöscht werden.

Ansicht "Taxonomy_Term":

$view = new view;
$view->name = 'Taxonomy_Term';
$view->description = 'A view to emulate Drupal core\'s handling of taxonomy/term; it also emulates Views 1\'s handling by having two possible feeds.';
$view->tag = 'default';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = '0';
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('sorts', array(
  'sticky' => array(
    'id' => 'sticky',
    'table' => 'node',
    'field' => 'sticky',
    'order' => 'DESC',
    'relationship' => 'none',
  ),
  'created' => array(
    'id' => 'created',
    'table' => 'node',
    'field' => 'created',
    'order' => 'DESC',
    'granularity' => 'second',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'term_node_tid_depth' => array(
    'id' => 'term_node_tid_depth',
    'table' => 'node',
    'field' => 'term_node_tid_depth',
    'default_action' => 'not found',
    'style_plugin' => 'default_summary',
    'style_options' => array(
      'count' => TRUE,
      'override' => FALSE,
      'items_per_page' => 25,
    ),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '%1',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'taxonomy_term',
    'validate_fail' => 'not found',
    'depth' => '0',
    'break_phrase' => 1,
    'relationship' => 'none',
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'album' => 0,
      'artist' => 0,
      'book' => 0,
      'page' => 0,
      'story' => 0,
      'track' => 0,
    ),
    'validate_argument_vocabulary' => array(
      '3' => 0,
      '4' => 0,
      '1' => 0,
      '5' => 0,
      '2' => 0,
    ),
    'validate_argument_type' => 'tids',
    'validate_argument_php' => '',
  ),
  'term_node_tid_depth_modifier' => array(
    'id' => 'term_node_tid_depth_modifier',
    'table' => 'node',
    'field' => 'term_node_tid_depth_modifier',
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(
      'count' => TRUE,
      'override' => FALSE,
      'items_per_page' => 25,
    ),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
  ),
));
$handler->override_option('filters', array(
  'status_extra' => array(
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
    'operator' => '=',
    'value' => '',
    'group' => 0,
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('use_pager', '1');
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'teaser' => TRUE,
  'links' => TRUE,
));
$handler = $view->new_display('page', 'Page', 'page');
$handler->override_option('path', 'taxonomy/term/%');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler = $view->new_display('feed', 'Core feed', 'feed');
$handler->override_option('items_per_page', 15);
$handler->override_option('use_pager', '1');
$handler->override_option('row_plugin', 'node_rss');
$handler->override_option('row_options', array(
  'item_length' => 'default',
));
$handler->override_option('path', 'taxonomy/term/%/%/feed');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('displays', array(
  'page' => 'page',
  'default' => 0,
));
$handler = $view->new_display('feed', 'Views 1 feed', 'feed_1');
$handler->override_option('items_per_page', 15);
$handler->override_option('use_pager', '1');
$handler->override_option('row_plugin', 'node_rss');
$handler->override_option('row_options', array(
  'item_length' => 'default',
));
$handler->override_option('path', 'taxonomy/term/%/feed');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));

 

Ansicht "Node":

$view = new view;
$view->name = 'Node';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = '0';
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Node', 'default');
$handler->override_option('arguments', array(
  'nid' => array(
    'default_action' => 'ignore',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Alle',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'empty',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'nid',
    'table' => 'node',
    'field' => 'nid',
    'relationship' => 'none',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'ajaxstory' => 0,
      'ccktax' => 0,
      'imagestory' => 0,
      'page' => 0,
      'profile' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'status_extra' => array(
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 1);
$handler->override_option('row_plugin', 'node');
$handler = $view->new_display('page', 'Seite', 'page_1');
$handler->override_option('path', 'node/%');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'weight' => 0,
));

 

  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • UTF-8 in Drupal
  • Berechtigung Registrierter Benutzer und zusätzliche Berechtigung für Redakteur
  • Gibt' s Ersatz für Omega?
  • [gelöst] Contact form "Send copy to sender" Anzeige Probleme
  • Modul Gaming Statistiken + Squad Modul
  • [gelöst] referenzierten Inhalt in Paragraph-Twig ausgeben - ohne clear_all_cache
  • Views Bilder anzeige mit Image [3+] counter
  • [gelöst] News Inhalte im View Block Zeit gesteuerte Veröffentlichung
  • Drupal 8 & Commerce 2 - Bestellbestätigungs-Mail bearbeiten
  • Gebuchte Anzeigen verarbeiten
  • Seite lädt nicht mehr nach update auf 8.6.9
  • Views filter basierend auf 2 Terms
Weiter

Neue Kommentare

  • Hallo Robert, könntest Du mir
    vor 16 Stunden 11 Minuten
  • Das ist vermutlich der Grund,
    vor 18 Stunden 53 Minuten
  • Ja, das ist er. Deswegen
    vor 19 Stunden 11 Minuten
  • Hallo montviso, so dachte ich
    vor 19 Stunden 42 Minuten
  • Kannst Du nicht bei Menü A
    vor 20 Stunden 26 Minuten
  • Du musst Dich im Grunde
    vor 1 Tag 12 Stunden
  • Das projekt wurde Abgesetzt
    vor 2 Tagen 2 Stunden
  • Wurde eine Lösung gefunden?
    vor 2 Tagen 9 Stunden
  • Ja. Das ist richtig so. Du
    vor 2 Tagen 12 Stunden
  • montviso schrieb Ich habe
    vor 2 Tagen 13 Stunden

Statistik

Beiträge im Forum: 241050
Registrierte User: 18316

Neue User:

  • danielwoe
  • arthur11
  • drupalHeIT

» Alle User anzeigen

User nach Punkten sortiert:
wla8567
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3863
ronald3724
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 5 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association