Drupal Cms Prezentace

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Drupal Cms Prezentace - Presentation Transcript

    1. Drupal CMS
    2. CMS: píšu jen specifickou funkčnost Jak to funguje?
    3. Modularita = znovupoužitelnost  Modulární architektura  Modulární témata  Vývoj vlastního modulu – Drupal API
    4. Instalace: next, next, next ...
    5. Modulární architektura
    6. Modulární architektura Jen 5 základních modulů   přes 30 modulů v default instalaci  volitelná jsou i menu, hledání, překlady, komentáře, blogy, fórum, ...
    7. Základní moduly <font color=\"ugly\">Lorem</font> http://ipsum.com a spousta jiných zajímavostí ... filter <p>Lorem <a href=\"http://ipsum.com\">http://ipsum.com</a> a spousta jiných zajímavostí ...</p> node user system blocks
    8. Další moduly „Navěsí se“ na základ  Svá data si uloží do svých tabulek  Příklad: comment.module Node table nid user id title text 1 1 Hello world 2 1 Lorem Ipsum ... 3 1 Had leze z díry vystrkuje kníry Comments table nid id replies to user id title text 1 1 NULL 1 Windowsy? Určitě jo! 2 2 NULL 1 Sic amet del requiem 1 3 1 2 Jojo… Windows rulez
    9. Hook = komunikace mezi moduly Jááá comments.module Renderujeme node, chcete k němu něco přidat? taxonomy.module Jááá Kdo implementuje hook_node( … )? vote.module Moi aussi Drupal core taxonomy module hook_nodeapi($node...): $node[“tags”][“content”] = OK, pošleme vám array( “tag1”, “tag2”); objekt node... $node[“tags”][“weight”] = 60; Přidejte a uberte co potřebujete //mezi telo a komentare
    10. Důležité hooky Oprávnění – hook_perm()  function mymodule_perm() { return array( 'access mymodule', 'administer mymodule'); }  Přidej do tabulky ‘oprávnění’ tato dvě
    11. Důležité hooky Menu a routing – hook_menu() položky  Název function mymodule_menu() { v menu $items['admin/settings/uploadcv/edit/%'] = array( 'title' => 'Edit consultant', 'page callback' => 'drupal_get_form', 'page arguments' => array('uploadcv_admin_edit', 3, 4), 'access arguments' => array('administer uploadcv'), 'type' => MENU_CALLBACK, 'parent' => 'admin/settings/uploadcv', 'file' => 'uploadcv.admin.inc', ); }  Přidej se do menu/routovací tabulky
    12. Důležité hookyfunkce jejíž výstup kde 3 a 4 = 3. a 4. se pošle uživateli parametr z url  (počítáno routing – hook_menu() Menu a od 0) function mymodule_menu() { $items['admin/settings/uploadcv/edit/%'] = array( 'title' => 'Edit consultant', 'page callback' => 'drupal_get_form', 'page arguments' => array('uploadcv_admin_edit', 3, 4), 'access arguments' => array('administer uploadcv'), 'type' => MENU_CALLBACK, s těmito třemi 'parent' => 'admin/settings/uploadcv', 'file' => 'uploadcv.admin.inc', parametry ); }  Přidej se do menu/routovací user musí mít tabulky tato práva
    13. Důležité hooky Menu a routing – hook_menu() položka nebude v  menu function mymodule_menu() { $items['admin/settings/uploadcv/edit/%'] = array( 'title' => 'Edit consultant', 'page callback' => 'drupal_get_form', 'page arguments' => array('uploadcv_admin_edit', 3, 4), 'access arguments' => array('administer uploadcv'), 'type' => MENU_CALLBACK, rodič položky 'parent' => 'admin/settings/uploadcv', (povede na něj odkaz) 'file' => 'uploadcv.admin.inc', ); }  Přidej se do menu/routovací tabulky soubor který se pro toto volání includuje
    14. Forms API
    15. Forms API Definice formuláře, Validace Akce po odeslání zobrazení
    16. Forms API function mymodule_agreement() { return drupal_get_form('uploadcv_accept_form'); zpracuj formulář s } tímto názvem function mymodule_agreement_form() { //definice formuláře } function mymodule_agreement_validate($form_id, $form_values) { if ( $form_values['values']['legal_accept‘]==0 ) { form_set_error('legal_accept', t('You must accept to continue.')); } //podmínky – s nastavenou chybou formulář nezvaliduje } function mymodule_agreement_submit($form_id, $form_values) { drupal_set_message(t('Thank you for agreeing.')); drupal_goto(“login/nextstep\"); } //funkce _submit proběhne jen když _validate nenajde chybu
    17. Forms API $form = array(); identifikace $form['id'] = array( formuláře '#type' => 'value', '#value' => 'legal'); $form['legal'] = array( '#type' => 'fieldset', '#title' => t('Terms and Conditions of Use'), '#weight' => 29 ); $form['legal']['conditions'] = array( '#type' => 'item', '#title' => t('Terms & Conditions'), '#value' => 'Legal Blah blah', '#rows' => 10, '#weight' => 0, '#attributes' => array('readonly' => '') ); $form['legal']['legal_accept'] = array( '#type' => 'checkbox', '#title' => t('I accept Terms & Conditions of Use'), '#default_value' => 0, '#weight' => 50, '#required' => TRUE); $form['save'] = array( '#type' => 'submit', '#value' => t('Proceed to upload'), '#weight' => 100); return $form;
    18. Forms API $form = array(); $form['id'] = array( '#type' => 'value', fieldset s '#value' => 'legal'); legendem $form['legal'] = array( '#type' => 'fieldset', '#title' => t('Terms and Conditions of Use'), '#weight' => 29 ); $form['legal']['conditions'] = array( '#type' => 'item', '#title' => t('Terms & Conditions'), '#value' => 'Legal Blah blah', '#rows' => 10, '#weight' => 0, '#attributes' => array('readonly' => '') ); $form['legal']['legal_accept'] = array( '#type' => 'checkbox', '#title' => t('I accept Terms & Conditions of Use'), '#default_value' => 0, '#weight' => 50, '#required' => TRUE); $form['save'] = array( '#type' => 'submit', '#value' => t('Proceed to upload'), '#weight' => 100); return $form;
    19. Forms API $form = array(); $form['id'] = array( '#type' => 'value', '#value' => 'legal'); $form['legal'] = array( '#type' => 'fieldset', '#title' => t('Terms and Conditions of Use'), '#weight' => 29 ); $form['legal']['conditions'] = array( '#type' => 'item', '#title' => t('Terms & Conditions'), '#value' => 'Legal Blah blah', '#rows' => 10, '#weight' => 0, item – prostě '#attributes' => array('readonly' => '') text s nadpisem, ); $form['legal']['legal_accept'] = array( je read only '#type' => 'checkbox', '#title' => t('I accept Terms & Conditions of Use'), '#default_value' => 0, '#weight' => 50, '#required' => TRUE); $form['save'] = array( '#type' => 'submit', '#value' => t('Proceed to upload'), '#weight' => 100); return $form;
    20. Forms API $form = array(); $form['id'] = array( '#type' => 'value', '#value' => 'legal'); $form['legal'] = array( '#type' => 'fieldset', '#title' => t('Terms and Conditions of Use'), '#weight' => 29 ); $form['legal']['conditions'] = array( '#type' => 'item', '#title' => t('Terms & Conditions'), '#value' => 'Legal Blah blah', '#rows' => 10, '#weight' => 0, '#attributes' => array('readonly' => '') ); $form['legal']['legal_accept'] = array( '#type' => 'checkbox', '#title' => t('I accept Terms & Conditions of Use'), '#default_value' => 0, checkbox – povinný: '#weight' => 50, required = TRUE '#required' => TRUE); $form['save'] = array( '#type' => 'submit', '#value' => t('Proceed to upload'), '#weight' => 100); return $form;
    21. Forms API $form = array(); $form['id'] = array( '#type' => 'value', '#value' => 'legal'); $form['legal'] = array( '#type' => 'fieldset', '#title' => t('Terms and Conditions of Use'), '#weight' => 29 ); $form['legal']['conditions'] = array( '#type' => 'item', '#title' => t('Terms & Conditions'), '#value' => 'Legal Blah blah', '#rows' => 10, '#weight' => 0, '#attributes' => array('readonly' => '') ); $form['legal']['legal_accept'] = array( '#type' => 'checkbox', '#title' => t('I accept Terms & Conditions of Use'), '#default_value' => 0, '#weight' => 50, '#required' => TRUE); $form['save'] = array( submit '#type' => 'submit', weight rozhoduje o pořadí '#value' => t('Proceed to upload'), '#weight' => 100); return $form;
    22. Modul může: implementovat systémové hooky   vytvořit vlastní hook  využívat funkce Drupal API  formuláře  překlad textů  abstrakce databáze  posílání mailů  upload souborů  hledání  node access – kontrola přístupu
    23. Modulární témata
    24. <?php print $header; ?> <?php if ($right): ?> <div id=\"sidebar-right“> <?php =$right ?> </div> <?php print $content_top; ?> <?php endif; ?> [themes/tema/tema.info] regions[header] = header regions[right] = right sidebar regions[content_top] = content top
    25. Konverze HTML pro Drupal: index.htm → themes/tema/page.tpl.php  metadata → themes/tema/tema.info  přidání <?php print $blok; ?>   případně <?php if ($blok) { ?>wrapper<?php } ?> … a pár povinných formalit
    26. Kdo ostyluje zbytek? Modul poskytuje: může změnit šablona  Datovou strukturu  Funkci pro převod datové struktury na HTML (konvence – vše je obalené divy s jednoznačnou třídou) CSS pro ostylování svého HTML 
    27. Time for… Namedropping
    28. The Onion
    29. SpreadFirefox.com
    30. CreativeBits.org
    31. Moby.com
    32. playboy.de
    33. Otázky?

    + keffkeff, 2 years ago

    custom

    1375 views, 0 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1375
      • 1361 on SlideShare
      • 14 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds
    • 14 views on http://blog.tomaskafka.com

    more

    All embeds
    • 14 views on http://blog.tomaskafka.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories