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.  
    6.  
    7.  
    8.  
    9.  
    10. Modulární architektura
    11. 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, ...
    12. Základní moduly node blocks user <font color=&quot;ugly&quot;>Lorem</font> http://ipsum.com a spousta jiných zajímavostí ... filter <p>Lorem <a href=&quot;http://ipsum.com&quot;>http://ipsum.com</a> a spousta jiných zajímavostí ...</p> system
    13. 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
    14. Hook = komunikace mezi moduly Renderujeme node, chcete k němu něco přidat? Kdo implementuje hook_ node ( … )? Drupal core comments.module taxonomy.module vote.module Jááá Jááá Moi aussi OK, pošleme vám objekt node... P řidejte a uberte co potřebujete taxonomy module hook_nodeapi($node...) : $node[“tags”][“content”] = array( “tag1”, “tag2”); $node[“tags”][“weight”] = 60; //mezi telo a komentare
    15. 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ě
    16. Důležité hooky
      • Menu a routing – hook _ 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,
      • 'parent' => 'admin/settings/uploadcv',
      • 'file' => 'uploadcv.admin.inc',
      • );
      • }
        • P řidej se do menu/routovací tabulky
      N ázev položky v menu
    17. Důležité hooky
      • Menu a routing – hook _ 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,
      • 'parent' => 'admin/settings/uploadcv',
      • 'file' => 'uploadcv.admin.inc',
      • );
      • }
        • P řidej se do menu/routovací tabulky
      kde 3 a 4 = 3. a 4. parametr z url (počítáno od 0) user musí mít tato práva funkce jejíž výstup se pošle uživateli s těmito třemi parametry
    18. Důležité hooky
      • Menu a routing – hook _ 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,
      • 'parent' => 'admin/settings/uploadcv',
      • 'file' => 'uploadcv.admin.inc',
      • );
      • }
        • P řidej se do menu/routovací tabulky
      položka nebude v menu rodič položky (povede na něj odkaz) soubor který se pro toto volání includuje
    19. Forms API
    20. Forms API
    21. Forms API
      • function mymodule_agreement() {
      • return drupal_get_form(' uploadcv_accept_form ');
      • }
      • 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('T hank you for agreeing. '));
      • drupal_goto(“ login / nextstep &quot;);
      • } //funkce _ submit proběhne jen když _validate nenajde chybu
      zpracuj formul ář s tímto názvem
    22. 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(
      • '#type' => 'submit',
      • '#value' => t('Proceed to upload'),
      • '#weight' => 100);
      • return $form;
      identifikace formul áře
    23. 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(
      • '#type' => 'submit',
      • '#value' => t('Proceed to upload'),
      • '#weight' => 100);
      • return $form;
      fieldset s legendem
    24. 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(
      • '#type' => 'submit',
      • '#value' => t('Proceed to upload'),
      • '#weight' => 100);
      • return $form;
      item – prostě text s nadpisem , je read only
    25. 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(
      • '#type' => 'submit',
      • '#value' => t('Proceed to upload'),
      • '#weight' => 100);
      • return $form;
      checkbox – povinn ý: required = TRUE
    26. 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(
      • '#type' => 'submit',
      • '#value' => t('Proceed to upload'),
      • '#weight' => 100);
      • return $form;
      submit weight rozhoduje o pořadí
    27. 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
    28. Modul ární témata
    29. <?php print $header; ?> <?php print $content_top; ?> <?php if ($right): ?> <div id=&quot;sidebar-right“ > <?php =$right ?> </div> <?php endif; ?> [themes/tema/tema.info] regions[header] = header regions[right] = right sidebar regions[content_top] = content top
    30. 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
    31. Kdo ostyluje zbytek?
      • Modul poskytuje:
      • 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
      m ůže změnit šablona
    32. Time for… Namedropping
    33. The Onion
    34. SpreadFirefox.com
    35. CreativeBits.org
    36. Moby.com
    37. playboy.de
    38. Otázky?

    + guest3d443eguest3d443e, 2 years ago

    custom

    400 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 400
      • 400 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    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