Drupal Basics

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 Basics - Presentation Transcript

    1. Salut! Gabriel Ungureanu Web Developer & Owner AG Prime http://www.ag-prime.com/ LinkedIn: http://www.linkedin.com/in/gabrielungureanu Twitter: http://www.twitter.com/gabiu Drupal: http://drupal.org/user/279352
    2. Experienţă 4 ani de web development Am lucrat cu: Moodle, Joomla, Drupal, custom CMS & Frameworks 1 an de Drupal
    3. De ce nu-mi place Drupal
      • Nu văd keyword-ul class
      • E greu de învăţat
      • No backwards compatibility intre versiuni majore
    4. Când aleg Drupal?
      • Pentru proiecte mari (foarte des a început să fie folosit ca framework – vezi OpenAtrium)
      • Când vreau să scriu puţin cod pentru multe sarcini. (chiar si fara cod ;) )
      • Când dezvolt un proiect care va cere multă mentenanţă ulterioară (publishing websites)
    5. Avantaje
      • O comunitate foarte mare şi cu suport prompt (incl. pe twitter - #drupal)
      • Peste 2400 de module şi teme disponibile la download
      • Tradus in peste 80 de limbi
      • Peste 200.000 membri, 300 useri noi zilnic
      • Peste 1800 de contribuitori şi peste 1600 de service providers
      • 4 canale de IRC cu sute de membri
      • 1:4 rata de răspuns pentru bug reports
      • 100 000 download-uri de Drupal Core / lună
    6. Drupal din punct de vedere POO Optimizare load-time (încarcarea dinamică a funcţiilor în funcţii) Implementează toate principiile POO:
        • Obiecte (module, teme)
        • Abstractizare (hook sistem)
        • Încapsulare (prin conventie: _user_save() - private, user_save() - public)
        • Polimorfism (ex. drupal_render() - generează codul html pentru un node)
        • Moştenire (temele sau modulele moştenesc comportamentul de baza şi extind, ex. themeName_links($links, $attributes)
    7. Design Patterns Singleton : modulele si temele pot fi considerate clase singleton (au o singura instanta) Decorator : prin hooks, de ex. hook_node_load() , hook_node_view() - orice modul poate adauga comportamente unui nod Observer : hooks, ex. Cand se face o modificare la un vocabular se apelează hook_taxonomy_vocabulary_update() Bridge : abstractizarea bazei de date – modulele sunt independente de baza de date folosita
    8. Design patterns Chain of Responsibility : la fiecare request se procesează calea primita, si se decide daca este un modul care sa proceseze acel request, daca utilizatorul are acces la el si ce functie va fi apelata pentru asta. Se merge in lant pana se rezolva, sau un modul refuza accesul pentru utilizator sau coada se termina. Command : de exemplu, un modul poate sa implementeze doar hook -urile de care are nevoie
    9. Drupal Module 3 tipuri:
      • Core modules – vin cu distributia de Drupal si sunt recomandate de Comunitate
      • Contributed modules – sunt testate si recomandate de comunitate si pot fi downloadate de pe drupal.org
      • Custom modules – dezvoltate de companii / developeri privati, in special pentru anumite proiecte.
    10. Developing a module Implementeaza hook-urile din core Ex. modules/hello_world.module function hello_world_menu() Implementeaza hook_menu() din core.
    11. Exemplu modules/hello_world.module <?php /** * @file * Hello World Module */ /** * Implementation of hook_menu(). */ function hello_world_menu() { $items = array(); $items['hello_world'] = array( 'title' => 'Hello World', 'description' => 'Basic Hello World message', 'page callback' => 'hello_world_say_hello', 'access arguments' => array('say hello'), 'type' => MENU_SUGGESTED_ITEM, ); return $items; } /** * Function which generate page (this generate any content - you need only your own code...) */ function hello_world_say_hello() { return '<p>Hello world!</p>'; } ?>
    12. Theming Controleaza look & feel -ul aplicatie Specifica reguinile de continut (tehnica frame) Poate contine CSS si Javascript necesar
    13. Structura unei teme
      • example.info (defineste regiunile, css si javascript) si optional tema parinte (base theme)
      • page.tpl.php – fisier template in format php ce controleaza look-ul generic al unei pagini
      • template.php – functii specifice template-ului (ex. se pot suprascrie elemente din module – textul unui buton)
    14. Ex. Minelli.info ; $Id: minnelli.info,v 1.7 2007/12/04 20:58:44 goba Exp $ name = Minnelli description = Tableless, recolorable, multi-column, fixed width theme. version = VERSION core = 6.x base theme = garland stylesheets[all][] = minnelli.css
        Structura:
      • name required
      • description recommended
      • screenshot
      • version discouraged
      • core required
      • engine required
      • base theme
      • regions
      • features
      • stylesheets
      • scripts
      • php
    15. .tpl.php files Nu necesita cunostinte suplimentare Cod HTML/PHP simplu Exemple ( si conventii de nume): page.tpl.php suprascrie templateul din system – modul de afisare al unei pagini page-front.tpl.php – prima pagina a site-ului search-result.tpl.php – pagina cu rezultatele cautarilor
    16. template.php Poate implementa hook-uri: ex. themeName_links($links, $attributes = array('class' => 'links')) Poti crea pagina de administrare pentru theme (implementare hook_menu )
    17. Drupal JS Implicit in core, Drupal incarca un obiect Drupal de forma { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; Avem acces la variabile, comportamente, poate aplica functii de templating sau putem avea access la traduceri (Drupal.t) Se poat adauga scripturi (ex. din module) cu drupal_add_js($data = NULL, $type = 'module')
    18. Va multumesc!
    19. Intrebari ?

    + Gabriel UngureanuGabriel Ungureanu, 3 months ago

    custom

    474 views, 0 favs, 2 embeds more stats

    My presentation from PHP Geek Meet #4 - Cluj Napoca more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 474
      • 413 on SlideShare
      • 61 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 7
    Most viewed embeds
    • 55 views on http://blog.ag-prime.com
    • 6 views on http://gabrielungureanu.ag-prime.com

    more

    All embeds
    • 55 views on http://blog.ag-prime.com
    • 6 views on http://gabrielungureanu.ag-prime.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