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

  • Medien und andere Daten mit Feeds von Drupal 7 auf Drupal 10 migrieren
  • für drupal11 ein Slider Modul
  • [gelöst] W3CSS Paragraphs Views
  • Drupal 11 neu aufsetzen und Bereiche aus 10 importieren
  • Wie erlaubt man neuen Benutzern auf die Resetseite zugreifen zu dürfen.
  • [gelöst] Anzeigeformat Text mit Bild in einem Artikel, Drupal 11
  • Social Media Buttons um Insteragram erweitern
  • Nach Installation der neuesten D10-Version kein Zugriff auf Website
  • Composer nach Umzug
  • [gelöst] Taxonomie Begriffe zeigt nicht alle Nodes an
  • Drupal 11 + Experience Builder (Canvas) + Layout Builder
  • Welche KI verwendet ihr?
Weiter

Neue Kommentare

  • Inzwischen sind wir bei
    vor 1 Woche 1 Tag
  • Migrieren von D7 auf D8/ D10/ D11
    vor 1 Woche 2 Tagen
  • melde mich mal wieder, da ich
    vor 8 Wochen 6 Tagen
  • Hey danke
    vor 9 Wochen 3 Stunden
  • Update: jetzt gibt's ein
    vor 9 Wochen 21 Stunden
  • Hallo, im Prinzip habe ich
    vor 9 Wochen 5 Tagen
  • Da scheint die Terminologie
    vor 9 Wochen 5 Tagen
  • Kannst doch auch alles direkt
    vor 10 Wochen 2 Tagen
  • In der entsprechenden View
    vor 10 Wochen 2 Tagen
  • Dazu müsstest Du vermutlich
    vor 10 Wochen 2 Tagen

Statistik

Beiträge im Forum: 250235
Registrierte User: 20462

Neue User:

  • marouane.blel
  • capilclinic
  • Quabzibboter

» Alle User anzeigen

User nach Punkten sortiert:
wla9461
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3857
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 20 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