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

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

Eingetragen von quiptime (4713) 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

  • Nur ein Bild pro Node ausgeben
  • Heartbeat und Facebook Style Status
  • Taxonomy Menu und D7.12DE
  • 1052 Column 'status' in where clause is ambiguous
  • [CEBIT] Die CeBIT-Quadratur des Drupal-Kreises?
  • Probleme bei Import mit Feeds
  • Danland: Standard-Startseite formatieren
  • Probleme mit dem Modul "Menu Block"
  • Taxonomie Titel und Beschreibung anzeigen
  • Modul für Absatznummern / Randnummern
  • Pfade zu Drupal-Core-Module korrigieren
  • Views Slideshow - mehrere Nodes gleichzeitig anzeigen
Weiter

Neue Kommentare

  • Es gibt in Views 3 bei den
    vor 47 Sekunden
  • Hi Frank, welche Version ist
    vor 18 Minuten 28 Sekunden
  • 7.x-1.2+16-dev
    vor 22 Minuten 31 Sekunden
  • Muß das Thema nochmal öffnen ..
    vor 24 Minuten 48 Sekunden
  • Ja, das ist leider so. Die
    vor 37 Minuten 9 Sekunden
  • Patrick Schanen schrieb ....
    vor 40 Minuten 8 Sekunden
  • Bei Drupal 7 gibt es nur
    vor 44 Minuten 21 Sekunden
  • Hier wird offensichtlich
    vor 59 Minuten 52 Sekunden
  • Hallo Werner, ich habe das
    vor 1 Stunde 3 Minuten
  • Views muß immer etwas zum
    vor 1 Stunde 16 Minuten

Statistik

Beiträge im Forum: 160314
Registrierte User: 14286

Neue User:

  • schmittrich
  • mah1987
  • Nadine.S

» Alle User anzeigen

User nach Punkten sortiert:
stBorchert5214
quiptime4713
Tobias Bähr3825
md3727
bv3680
Thoor3282
Alexander Langer3155
wla2795
dereine2630
pebosi2495
» User nach Punkten
Zur Zeit sind 0 User und 3 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Showroom
  • » Forum
  • » Drupalchannel
  • » Ü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
  • Bücherecke

Quicklinks III

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

RSS & Twitter

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