SlideShare une entreprise Scribd logo
1  sur  264
Drupal CMS - v17
hans.rossel@koba.be – Twitter @haro - www.koba.be




                       Informatics       Hans Rossel - www.koba.be
Wat is Drupal
CMF                             (W)CMS
Content Management              Content Management Systeem
  Framework
                                www.drupal.org
http://api.drupal.org
                                www.drupal.com
hooks, callbacks & overrides
                                www.drupal.be




                               Informatics   Hans Rossel - www.koba.be
Situering: CMS concurrenten
Gesloten: Tridion, Sharepoint, Documentum,
Stellent
Open source
Java: Alfresco, Liferay, OpenCMS
Python: Plone (Zope webserver, ZODB)
Php:
Joomla (Mambo)
Wordpress
Typo3
Asp: Dotnetnuke
                       Informatics   Hans Rossel - www.koba.be
Bron: Cmswire Open Source CMS Market Share Report (2009)
                          Informatics      Hans Rossel - www.koba.be
Trends Open Source CMS
   www.google.com/trends en www.indeed.com/jobtrends




                           Informatics           Hans Rossel - www.koba.be
Informatics   Hans Rossel - www.koba.be
Referenties
          Media/Entertainment
VRT, VTM, VT4, Vitaya, RTBF
Sony BMG Music, Universal Music Group, Warner Bros,
   20th Century Fox, Michael Jackson, Eric Clapton and
   Robbie Williams, Grammy awards, Emmy awards
The Examiner, The Economist, Le Figaro, Edipresse,
   Infoworld, Aj Jazeera
Studio Brussel, Radio Netherlands Worldwide, Australian
   Broadcast Company, BBC, CNN, Reuters
Virgin, Slate, Monthy Python and Lucas Arts




                            Informatics   Hans Rossel - www.koba.be
NGO, Gov & edu
Human Rights watch, Amnesty
World Food Programme, World Bank, United Nations, Europese Unie,
    World Economic Forum
Witte Huis, Vlaanderen, New York state senate, US Department of
    Commerce, Belgische Premier, Belgische Monarchie, FOD
    Financiën, the French government, the Dutch government, the
    Australian Prime Minister and the British Government, London en
    Athene.
Universiteit Gent, Duke University, Strayer University, Portland
    University, MIT, Stanford University and Harvard
UitinVlaanderen, FARO, Louvre, Tate, Vlaamse Kunstcollectie
NASA (http://themis.asu.edu/)
Linux Foundation, JAVA.net en Internet Systems Consortium


                                 Informatics      Hans Rossel - www.koba.be
Enterprises using Drupal
Telenet, ING, Garmnin, Ebay, Symantec, Nokia,
  AHOLD, Randstad, Sony Ericsson, Paypal, Twitter,
  Mattel, Nvidia, Rackspace, AT&T, FUJI film,
  General Motors, Intel, Fujifilm, Fedex, IBM, Cap
  Gemini, Accenture, Procter & Gamble en Google
  (mlab), IKEA
Zenito (svmb/admb)

Meer referenties:
http://www.buytaert.net/tag/drupal-sites


                           Informatics     Hans Rossel - www.koba.be
Voordelen Drupal
Open Source GPLv2: broncode vrij downloadbaar en aanpasbaar
Geen licentiekosten.
Geen Vendor Lock-In. Veel bedrijven. Geen “eenmans” Open
  Source CMS
Grote community & sterke groei: veel support, testen, activiteit
Up-to-date, mee met nieuwe ontwikkelingen
Php = meest gebruikte webprogrammeertaal
Uitvoerig getest: 3.2 miljoen keer/jaar gedownload, grote sites
   gebruiken het
10000 Modules = Veel kostefficiënte uitbreidingen
  http://drupal.org/project/Modules



                                Informatics       Hans Rossel - www.koba.be
Troeven Drupal
Kwaliteit code & modulaire uitbreidbaarheid
      Heel flexibel framework (CMF) met goede stabiele architectuur en code heel geschikt voor
          maatwerk. Uitgebreide en uitvoerig gedocumenteerde API (api.drupal.org)

Social media aspecten
     “Online community” aspecten al vanaf het prille begin ingebouwd: taxonomie, user rollen,
         comments.Volwassen functionaliteiten

Volledig Open Source GPLv2 (geen “dual licence”)
      Alle modules vrij downloadbaar (vgl. Joomla), community edition is full option (vgl. Alfresco,
          SugarCRM). Activiteit en info gecentraliseerd op www.drupal.org (vgl Joomla)

Enterprise ready
     Steeds meer grote referenties => uitvoerig getest, gedocumenteerde integratiemogelijkheden,
         performance, scaling, caching.
     Commerciële ondersteuning van het project Acquia, Drupal Association

Community & ecosysteem
    Grote en open community gebaseerd op Open Source principes van samenwerken (vgl Joomla:
       http://buytaert.net/joomla-vs-drupal-business-models-and-commercial-ecosystem).
     Veel ontwikkelaars, veel support.

Made in Belgium


                                                   Informatics               Hans Rossel - www.koba.be
Integratie Drupal
DMS: Document management
   Beperkte reeks modules voor doorzoeken van pdf, word, excel
   Integratie met Alfresco via CMIS.

CRM: Contact Relationship Management
   Integratie met CiviCRM, SugarCRM, …

Knowledge Management Portal (Intranet)
   Open Atrium Distributie (Wereldbank Intranet) en LDAP integratie modules

Project Management
   Drupal Modules: Storm, Casetracker, Project

Webshop
   Ubercart/Drupalcommerce module of integratie met Magento

Webservices
   SOAP, Rest, XMLRPC, Services module.




                                            Informatics             Hans Rossel - www.koba.be
Geschiedenis
1999 Dries Buytaert
Recente versies focus
4.7: Form API, admin interface
5: Mature & Stable, CCK, Views
6: Multilingual support, theming layer
7: Usability (image), Unit testing, php5.2.6, Semantic web,
fields API
8: Webservices (Symfony 2, OO php), Configuration
management, mobile, html5, design, multilingual. Zie
http://groups.drupal.org/drupal-initiatives

                               Informatics   Hans Rossel - www.koba.be
Omvang Drupal project
> 10000 Modules (= plugins, extensies)
> 1.6 miljoen pagina's en > 850.000 users op drupal.org
Drupal core werd 3.2 miljoen keer gedownload in 2009 en
draagt meer dan 600.000 actieve websites
(http://drupal.org/project/usage)
Twee delen
Core: >700 ontwikkelaars (D6), 62 duizend lijnen code (=15
persoonjaren = 837 duizend dollar, bron ohloh.net).
Contributed: >1300 ontwikkelaars, 2.6 miljoen lijnen code (=765
persoonjaren = 42 miljoen dollar, bron ohloh.net)
42 talen, >1000 gratis Themes (meer vb
Templatemonster, ...)
                                    Informatics     Hans Rossel - www.koba.be
Groei




  Informatics   Hans Rossel - www.koba.be
Leercurve developers




         Informatics   Hans Rossel - www.koba.be
Community

Internationaal
  www.drupal.org
  http://planet.drupal.org: Blogs
  http://groups.drupal.org: Werkgroepen
België
  Www.drupal.be
  Www.drupal.be/support: Bedrijven



                       Informatics   Hans Rossel - www.koba.be
Systeemvereisten
Standaard            Alternatieven
Apache              Lighttpd
                    IIS mits aanpassingen voor php
> MySQL 5.0.15      PostgreSQL
> Php 5.2 (+pdo)    MSSQL, Oracle via php PDO.

Php RAM > 50MB
min



                   Informatics     Hans Rossel - www.koba.be
Basisfunctionaliteiten
Zoekfunctie
RSS
Meertaligheid
Statistieken
Login-systeem met rollen
Reactiesysteem
SEO vriendelijke urls
Taxonomie


                           Informatics   Hans Rossel - www.koba.be
Basiselementen
Users
Entities Nodes
Blokken
Menu
Taxonomy
Fields
Views

                 Informatics   Hans Rossel - www.koba.be
Basisfunctionaliteiten
Zoekfunctie
RSS
Meertaligheid
Statistieken
Login-systeem met rollen
Reactiesysteem
SEO vriendelijke urls
Taxonomie

                           Informatics   Hans Rossel - www.koba.be
HOOFDSTUK 2




INSTALLATIE DRUPAL CORE




           Informatics   Hans Rossel - www.koba.be
Origineel of voorverpakt
Origineel drupal.org
Via Windows installer:
http://acquia.com/downloads/windows-installer
Via controlepaneel: Installatron, Fantastico
Drupal gardens
Distributies (http://drupal.org/project/distributions)
Open Atrium
Open Publish
Pressflow
Nodestream
Commerce Kickstart
Open Public




                                Informatics     Hans Rossel - www.koba.be
Systeemvereisten
Standaard             Alternatieven
Apache               Lighttpd
MySQL 5              IIS mits aanpassingen
Php 5.2 (nog geen    PostgreSQL
5.3)                 Sinds D7: nieuwe abstraction
                     layer die andere databases
                     (MSSQL, Oracle) ondersteunt via
                     php PDO.



                    Informatics    Hans Rossel - www.koba.be
Installatie nodig

Hosting of LAMP op localhost
> Mysql 5: database
> php 5.2: programmeertaal
Apache mod rewrite bruikbaar in .htaccess
Voldoende geheugen
http://drupal.be/documentatie/drupal-hosting




                         Informatics   Hans Rossel - www.koba.be
Lamp server op Ubuntu
                  (debian)
sudo aptitude install php5 apache2 mysql-
  server phpmyadmin php5-mysql
  libapache2-mod-php5 php5-cli (voor
  drush)
root user paswoord instellen voor mysql
phpmyadmin: spatiebalk drukken om apache2 te kiezen + ok
testen: localhost, localhost/phpmyadmin
sudo /etc/init.d/apache2 restart


Alternatief: sudo tasksel install lamp-server
Meer info:
  https://help.ubuntu.com/community/ApacheMySQLPHP


                                          Informatics      Hans Rossel - www.koba.be
Mod rewrite installeren


1) sudo a2enmod rewrite
2) sudo pico /etc/apache2/sites-
enabled/000-default
3) Change AllowOverride None to
AllowOverride All
4) Restart Apache: sudo
/etc/init.d/apache2 force-reload


                   Informatics   Hans Rossel - www.koba.be
Drupal core downloaden

Op drupal.org
Drupal 6... downloaden (of Drupal 5...)
Nederlandse taal downloaden (eerst doen!)
Gebundeld www.drupal.be
Op alternatieve lokatie (oudere versies)
http://ftp.drupal.org/files/projects/




                            Informatics   Hans Rossel - www.koba.be
Software
http://www.mozilla-europe.org/en/firefox/
https://addons.mozilla.org/en-US/firefox/addon/1843

http://www.wampserver.com/en/download.php
Installeren in c:wamp




                             Informatics   Hans Rossel - www.koba.be
Wampserver
Skype uitschakelen
Start all services
Apache rewrite module aan
Localhost testen
Bestanden in C:wampwww
http://drupal.org/drupal-6.5
En http://drupal.org/project/nl extract in root
Unpack (7-zip)
Localhost: drupal6-5


                                Informatics       Hans Rossel - www.koba.be
Database maken

http://localhost/phpmyadmin/
Home > databases > create new database
Users > create new user
All privileges




                    Informatics   Hans Rossel - www.koba.be
Installatie

# Copy the ./sites/default/default.settings.php
file to ./sites/default/settings.php.
# Change file permissions so that it is
writable by the web server.




                       Informatics   Hans Rossel - www.koba.be
Installatie zelf

Database gegevens invullen
Gegevens site invullen




                    Informatics   Hans Rossel - www.koba.be
Bestandsstructuur

Mappen en inhoud
Core niet hacken!
Sites map instellen: modules/templates
Files instellen




                        Informatics   Hans Rossel - www.koba.be
php.ini
Foutreportage & security
register_globals = Off

Upload en timout limieten
memory_limit = 128M
upload_max_filesize = 150M
post_max_size = 150M
max_input_time = 300
max_execution_time = 300




                                Informatics   Hans Rossel - www.koba.be
php.ini settings

Kunnen ingesteld worden op
Een bestandje php.ini uploaden in root
In .htaccess
php_flag register_globals off
php_value memory_limit "128M"
php_value max_execution_time 300
In settings.php van Drupal
In een gewoon stukje php code: http://www.php.net/ini_set (enkel geldig
tijdens script)

Let op
Syntax verschilt tussen werkwijzen
Als .htaccess error 500 geeft staat hosting dit niet toe

                                     Informatics           Hans Rossel - www.koba.be
Installatie op cpanel hosting
Drupal 7 uploaden met
http://filezilla-project.org/download.php?type=client
Een database aanmaken bij databases (niet in phpmyadmin)
Eerst database maken
Dan user maken
Dan user toevoegen aan database, all privileges
Drupal installatie
Databasenaam en username worden vaak geprefixt met
accountname bij hosting: dus accountname_username en
accountname_databasename gebruiken
Permissies files en settings instellen

                               Informatics   Hans Rossel - www.koba.be
Admin: Basiselementen
Users
Nodes
Blokken
Menu
Taxonomy
CCK
Views

                  Informatics   Hans Rossel - www.koba.be
HOOFDSTUK 3


EEN SIMPELE BROCHURESITE
        MET ENKEL
       DRUPAL CORE
      EEN WYSYWYG
    EEN PREFAB THEME



           Informatics   Hans Rossel - www.koba.be
Basisinstellingen installatie
Site instellingen
Bestands upload
Bestandssysteem
Datum en tijd
Foutrapportage
Site onderhoud
Websitegegevens

Inhoudelijk beheer
Teaserlengte, taxonomie, ...

Gebruikers
Rollen admin en redactie aanmaken + rechten instellen
Gebruikers toevoegen aan een rol
                                   Informatics    Hans Rossel - www.koba.be
Navigatie

Blokken: keuze plaats menu
Menus
Primary & secundary links
Settings
Items toevoegen
Tijdens het invoeren/bewerken van een pagina
Via de menu interface




                            Informatics   Hans Rossel - www.koba.be
Gewone pagina's toevoegen

Opbouwen structuur
Home: promoted items
Over ons
Producten
Referenties
Contact: contact module




                          Informatics   Hans Rossel - www.koba.be
WYSYWYG

De editor
www.drupal.org/project/wysiwyg
Externe editor downloaden: Ckeditor, Tinymce
Alternatief Bueditor, Markdown of Aloha editor (html5)

Afbeeldingen in de editor
www.drupal.org/project/imce
www.drupal.org/project/imce_wysiwyg




                                 Informatics    Hans Rossel - www.koba.be
WYSYWYG installatie & werking

Stappen (ook algemeen voor installeren module)
Issues bekijken: critical bugs ea bugs + versie kiezen
Opladen van de module
readme.txt lezen en online handboek
Eventuele core patches installeren
Dependend modules aanvinken op admin/build/modules
Aanvinken op admin/build/modules
Toegangsrechten controleren
Module settings instellen
Kijken als er te activeren blokken zijn bijgekomen


                                 Informatics     Hans Rossel - www.koba.be
Search

Zoekfunctie en instellingen
Cron laten lopen om index op te vullen




                      Informatics   Hans Rossel - www.koba.be
POORMANSCRON
Noodzaak cron
Wissen log bestanden
Andere automatische taken
Voordelen
Simpel te installeren
Nadelen
Niet regelmatig: start na tijd én nadat user inlogt
Niet geschikt voor versturen nieuwsbrieven
Alternatief: crontab op server: aan te raden
http://drupal.org/cron
Kan makkelijk op cpanel hosting

                                  Informatics         Hans Rossel - www.koba.be
HOOFDSTUK




THEMES (basis)




      Informatics   Hans Rossel - www.koba.be
Bartik en Seven

Standard frontend en backend theme Drupal
7
Bartik is bedoeld om uitgebreid te worden via
een subtheme (zie theme les)




                      Informatics   Hans Rossel - www.koba.be
Prefab themes
Op Drupal.org
http://drupal.org/project/Themes

Commercieel
  http://fusiondrupalthemes.com/
  http://www.topnotchthemes.com/portfolio
  http://www.templatemonster.com/drupal-themes.php




                                   Informatics   Hans Rossel - www.koba.be
MODULES



   WAAR
   KEUZE
INSTALLATIE




     Informatics   Hans Rossel - www.koba.be
Een module kiezen
Overzicht:
http://drupal.org/project/Modules: thematisch
http://drupal.org/project/Modules/name: alfabetisch

Related projects & discussions
Populariteit
http://drupal.org/project/usage: populariteit
http://acquia.com/products-services/acquia-drupal-modules:
geselecteerd & ondersteund door Acquia
Ratings: http://drupalmodules.com
Nieuwe modules: http://drupal.org/taxonomy/term/14
Video http://www.lullabot.com/node/439/play

                                  Informatics   Hans Rossel - www.koba.be
Status van een module
Versie 6 of 7
Status:
Official release
Pre-alpha, Alpha, beta, rc (release candidate)
Dev versies
Opgelet met updates van 7.x-1.x naar 7.x-2.x




                          Informatics   Hans Rossel - www.koba.be
Factoren kwaliteit module
Tijd: maturiteit & actief onderhouden?
Eerste versie
Laatste update/commit (+ view cvs messages: most active projects)
Tijd tussen de updates

Futureproof?
Drupal 6/7 versie

Ontwikkelaar(s)
Aantal
Hoelang betrokken bij Drupal
Andere modules waarvoor verantwoordelijk (cvs messages: most active
developers)
User profile + track & track code


                                     Informatics       Hans Rossel - www.koba.be
Factoren (vervolg)
Issue queue
Aantal meldingen (populariteit module)
Aantal bugs & opgeloste bugs
Aantal patches (betrokkenheid externe developers)
Statistieken

Omvang module
Een klein probleem vraagt een kleine module
Geen module als je met enkele lijntjes code kunt oplossen
Gevaar voor modulitis: performance site zakt bij elke module die je toevoegt

Module usage statistics
Concurrerende modules:
zie blokken related content

                                         Informatics        Hans Rossel - www.koba.be
Issue queue
Vragen over één module steeds hier stellen, niet op forum
Statussen, category & priority
Advanced search
Drupal core issues: http://drupal.org/project/issues/drupal
Ingeven van een issue
Zoeken naar duplicates
Heel duidelijke omschrijving (reproduceerbaar probleem): versies, browser, andere
zaken geinstalleerd, stappen hoe je kunt reproduceren op “fresh install”,
screenshots, code, views export, cck export
Verwijzing naar node via filter
Geen titel wijzigen
Subscribe? Hopelijk betere oplossing toekomst. Zie ook my issues.

Video: http://www.lullabot.com/node/386/play

                                       Informatics        Hans Rossel - www.koba.be
BASIS MODULES



         TOPMODULES
NODIG VOOR bijna ELKE INSTALLATIE




                Informatics   Hans Rossel - www.koba.be
CCK EN VIEWS




     Informatics   Hans Rossel - www.koba.be
CCK/Fields

Historiek en evolutie
Nodes → Flexinode → cck contributed (→ fields in core)

Doel
Eigen content types met eigen velden definiëren

Download
http://drupal.org/project/cck
Extra fields: http://drupal.org/project/Modules/category/88




                                   Informatics     Hans Rossel - www.koba.be
Basis cck fields

Voornaamste extra fields
http://drupal.org/project/imagefield
http://drupal.org/project/filefield
http://drupal.org/project/date
http://drupal.org/project/email
http://drupal.org/project/link
http://drupal.org/project/emfield




                                  Informatics   Hans Rossel - www.koba.be
Afbeeldingen

Modules: CCK afbeeldingsveld
Imagefield
ImageAPI
Imagecache
Fotoalbum
Lightbox2
In combinatie met imagecache (vaste hoogte),
views grid view, of css float left


                        Informatics   Hans Rossel - www.koba.be
Imagecache
www.drupal.org/project/imagecache
Voordelen
Kan via voorgedefinieerde presets images scalen, resizen
en croppen
Je kunt verschillende varianten van dezelfde foto
automatisch laten genereren




                              Informatics   Hans Rossel - www.koba.be
VIEWS
Versies
Views 1: Drupal 5: enkel van nodes
Views 2: Drupal 6: http://views-help.doc.logrus.com/
Download
http://drupal.org/project/views
http://drupal.org/project/simpleviews: eenvoudig via views
api
Doel
Lijsten trekken van titels, teksten, foto's, ...
Workshop
Enkele basisviews aanmaken
                                  Informatics      Hans Rossel - www.koba.be
Informatics   Hans Rossel - www.koba.be
Views2

http://blip.tv/file/995855
http://blip.tv/file/1257026/
http://views-help.doc.logrus.com/admin/advance




                     Informatics   Hans Rossel - www.koba.be
Relationships

http://blip.tv/file/1593750




                        Informatics   Hans Rossel - www.koba.be
Theming Basics & Instellingen




              Informatics   Hans Rossel - www.koba.be
Theme instellingen




           Informatics   Hans Rossel - www.koba.be
Instellingen & Keuze
               theme
Templates: admin/build/themes
Core themes en nut
Variabelen, logo, snelkoppelingsikoon
Berichtinformatie weergeven over
Zen ea: extra theme settings
Extra variabelen: admin/settings/site-information
Eigen template: user/uid/edit (toegangsrechten)
Beheertemplate: admin/settings/admin
Blokken en menu's

                            Informatics   Hans Rossel - www.koba.be
Prefab themes installeren
Locatie: sites/all/themes
Op Drupal.org
http://drupal.org/project/Themes
Alternatieve weergave
http://themegarden.org/drupal6/
http://www.osskins.com/main/category/drupal/
http://www.siteground.com/drupal-hosting/drupal-themes.htm
http://themebot.com/website-templates/drupal-themes

Ontwerpers
http://alldrupalthemes.com/: ADT
http://www.roopletheme.com/: roopletheme

                                   Informatics    Hans Rossel - www.koba.be
Mooie Drupal Themes
http://drupal.org/project/acquia_slate
http://drupal.org/project/marinelli
http://drupal.org/project/absynthe
http://drupal.org/project/acquia_marina
http://drupal.org/project/addari
http://drupal.org/project/analytic
http://drupal.org/project/colorpaper
http://drupal.org/project/darkelegance
http://drupal.org/project/fervens
http://drupal.org/project/magazeen
http://drupal.org/project/scruffy
http://drupal.org/project/tma




                                          Informatics   Hans Rossel - www.koba.be
Betalende Themes
Top Notch Themes: goede themes van een bedrijf
gegroeid uit de Drupal community, wat een goede
integratie garandeert
Templatemonster: Drupal themes van een grote template
aanbieder
http://www.fordrupal.com
http://danaythemes.com
http://www.drupalshark.com/catalog/themes
http://www.themesnap.com/drupal-themes.html




                           Informatics   Hans Rossel - www.koba.be
Starter Themes
http://drupal.org/project/zen
http://drupal.org/project/genesis
http://drupal.org/project/framework
http://drupal.org/project/stark
http://drupal.org/project/studio
http://drupal.org/project/cleanstate
http://drupal.org/project/hunchbaque




                             Informatics   Hans Rossel - www.koba.be
CSS Framework Starter
          Themes
css frameworks zijn erg handig om snel complexe layouts te
      maken die standard compliant zijn. Bekende voorbeelden
      zijn Blueprint en 960.gs. Bij Drupal vind je de volgende
      themes die hierop gebaseerd zijn:


http://drupal.org/project/blueprint
http://drupal.org/project/ninesixty
http://drupal.org/project/ninesixtyfluid



                               Informatics     Hans Rossel - www.koba.be
Admin Themes
Nu er erg wordt gewerkt aan het verbeteren van de User
     Experience en Usability van Drupal zijn er recent heel wat
     mooie admin themes beschikbaar. Ze zijn bedoeld als
     theme voor de backend van Drupal en je stelt ze in als
     beheertemplate.
http://drupal.org/project/rootcandy
http://drupal.org/project/admin
http://drupal.org/project/controlpanel




                               Informatics     Hans Rossel - www.koba.be
Betalende Theme services
Top Notch Themes: goede themes van een bedrijf gegroeid uit de Drupal community, wat
een goede integratie garandeert
Templatemonster: Drupal themes van een grote template aanbieder
http://www.fordrupal.com
http://danaythemes.com
http://www.drupalshark.com/catalog/themes
http://www.themesnap.com/drupal-themes.html
Bepaalde bedrijven kunnen ook een psd omzetten naar een
  Drupal theme:
http://vandelaydesign.com/blog/design/psd-to-html-services
http://www.psd2html.com/about-us.html (http://drupal.org/node/242847)
https://w3-markup.com/order#drupal
Software zoals http://www.artisteer.com kan een standaard maar
  aanpasbaar Drupal theme opzetten.

                                            Informatics         Hans Rossel - www.koba.be
Bestandsstructuur van een theme




               Informatics   Hans Rossel - www.koba.be
Basisbestanden:
                 phptemplate
.info: definitie van theme
screenshot.png
Css: Gewoonlijk: style, print, ie6
Template files
page.tpl.php, node.tpl.php, block.tpl.php
31 template bestanden in core in D6
(http://drupal.org/node/190815#default-templates)

template.php

                                               Informatics   Hans Rossel - www.koba.be
Theme anatomie




         Informatics   Hans Rossel - www.koba.be
Customizen theme
Template files: 31 in core
In theme map
In modules map: te overschrijven
CSS
In theme map: style.css of meer volgens .info
In modules map: te overschrijven
30 stylesheets IE: http://drupal.org/project/unlimited_css of
http://adaptivethemes.com/load-unlimited-stylesheets-in-ie7
Theme functions
In theme map: template.php voor overschrijven theme_ functies en
preprocess vars
In modules map: in code theme_... (core zie api.drupal.org of
http://api.freestylesystems.co.uk voor contrib)
                                    Informatics       Hans Rossel - www.koba.be
.info

; $Id: garland.info,v 1.5 2007/07/01 23:27:32 goba Exp $
name = Garland
description = Tableless, recolorable, multi-column, fluid width theme
    (default).
version = VERSION
core = 6.x
engine = phptemplate
stylesheets[all][] = style.css
stylesheets[print][] = print.css

; Information added by drupal.org packaging script on 2008-10-08
version = "6.5"
project = "drupal"
datestamp = "1223497210"


                                    Informatics       Hans Rossel - www.koba.be
page.tpl.php
Gebruik van variabelen:
<?php if ($left): ?>
 <?php print $left; ?>
<?php endif; ?>


<?php if ($is_front): ?>
 <?php print t('Welkom op de homepage!'); ?
 >
<?php endif; ?>
                     Informatics   Hans Rossel - www.koba.be
Weergave theme functions
Voorbeeld:
<?php if ($primary_links): ?>
  <?php print theme('links', $primary_links); ?>
<?php endif; ?>
Gebruikt http://api.drupal.org/api/function/theme_links/6

Alternatief
Menu tree: <?php print theme('menu_tree', menu_tree('primary-
  links')); ?>
Gebruikt: http://api.drupal.org/api/function/theme_menu_tree/6



                                    Informatics       Hans Rossel - www.koba.be
Een nieuw theme ontwikkelen




             Informatics   Hans Rossel - www.koba.be
Vertrekpunten
Starten vanaf een bestaande statische html
prototype/wireframe (from scratch of http://www.oswd.org)

Starten vanaf Zen theme: hacken via subtheme

Starten vanaf een bestaand (of eigen basistheme) Drupal
theme: hacken of subtheme




                             Informatics     Hans Rossel - www.koba.be
Een nieuw theme ontwerpen

           METHODE 1:
Starten vanaf een statische prototype




                  Informatics   Hans Rossel - www.koba.be
Wireframe




      Informatics   Hans Rossel - www.koba.be
file:///D:/HANSWERKMAP/KOBA/klanten%20en%20offerteaanvragen/gentverwent/wireframes/wireframes_detailfiche%20copy.jpg




                                                                                                                       Informatics   Hans Rossel - www.koba.be
Statische prototype
Een gewone html pagina of versie van de
hoofdpagina's van je site
Html en css voor Drupal
Gebruik geen .content, .links, .menu, .header, .picture:
worden reeds gebruikt door Drupal & geeft conflicten
Bedenken wat regions en wat blokken zullen zijn
Rekening houden met .item-list en andere door core
gegenereerde html en styles
Gebruik – ipv _ in class en id namen


                               Informatics    Hans Rossel - www.koba.be
Belangrijke css aspecten
Box model
Display:inline; en display:block; Wat standaard & Verschil margins.
Problemen met float drupping bij IE padding: dus .inner of margin
Floats
Float design: alles floaten en tussendoor clearen
Verschil display:inline; en float:left; voor lists
Floated image eerst en blok die het omvat moet ook gefloat zijn
Lijsten:
Koppig wegens inheritance, geen !important
Drupal .item-list class overriden
Conditional comments ipv hacks


                                        Informatics   Hans Rossel - www.koba.be
Opgelet: Caching
Na elke wijziging in template, cache wissen.
6 Manieren:
Klik op de "cache data opschonen" knop op Beheren > Site-instellingen >
Prestatie.
Klik in Devel block op de "Empty cache" link.
Bezoek de Beheren > Site-constructie > Templates pagina (werkt niet altijd)
Views theme information
template.php: drupal_rebuild_theme_registry();
Zen theme settings




                                        Informatics        Hans Rossel - www.koba.be
STAP 1: Theme folder
Maak een mapje in sites/all/themes met de
naam van je theme vb abc
Stel admin theme in op Garland




                     Informatics   Hans Rossel - www.koba.be
STAP 2: .info file: basis
.info handbook: http://drupal.org/node/171205
Maak abc.info file met inhoud
; $Id$
name = abc
description = ABC theme
version = 1.0
core = 6.x
engine = phptemplate


                             Informatics    Hans Rossel - www.koba.be
.info file: regions
Standaard:
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer




                                 Informatics   Hans Rossel - www.koba.be
.info file: eigen regions
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[header] = Header
regions[footer] = Footer


regions[content_top] = Content top
regions[content_bottom] = Content bottom
regions[navbar] = Navbar
regions[helemaalrechtsboven] = Helemaal rechts boven
Opm: Bestaande naamgeving best behouden, maar eigen nieuwe toevoegen



                                      Informatics      Hans Rossel - www.koba.be
STAP 3: css
In .info file:
stylesheets[all][] = style.css
stylesheets[print][] = print.css
Oude methode (d5):
in template.php via
vb: drupal_add_css(drupal_get_path('theme', 'abc') . '/mystyle.css',
'theme');

In page.tpl.php:
<?php print $styles; ?>



                                    Informatics       Hans Rossel - www.koba.be
STAP 4: page.tpl.php
Sla je statische pagina op onder de naam page.tpl.php.
Dynamisch maken: $title, $content en $tabs invoegen.
Constructie invoegen variabelen
(Theme coding conventions: http://drupal.org/node/1965)
<?php if ($tabs): ?>
  <div class="tabs">
   <?php print $tabs; ?>
  </div>
<?php endif; ?>




                                      Informatics         Hans Rossel - www.koba.be
Regions (blokken)
             invoegen
Zoals gedefinieerd in .info file: $header, $left, $right, $footer,
  $content_top, $content_bottom, $navbar
     <?php if ($content_top): ?>
      <div id="content-top" class="region">
        <?php print $content_top; ?>
      </div>
     <?php endif; ?>




                                 Informatics    Hans Rossel - www.koba.be
Navigatie invoegen
<?php if ($primary_links): ?>
 <div id="primary">
  <?php print theme('links', $primary_links); ?>
 </div>
<?php endif; ?>


<?php if ($secondary_links): ?>
 <div id="secondary">
  <?php print theme('links', $secondary_links); ?>
 </div>
<?php endif; ?>



                                       Informatics   Hans Rossel - www.koba.be
Logo
<?php if ($logo): ?>
 <div id="logo">
  <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>">
  <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" title="<?php
  print t('Home'); ?>" />

  </a>

 </div>
<?php endif; ?>




                                      Informatics         Hans Rossel - www.koba.be
Breadcrumbs
<?php if ($breadcrumb): ?>
 <div class="breadcrumb">
  <?php print $breadcrumb ?> &raquo; <?php print $title; ?>
 </div>
<?php endif; ?>




                             Informatics   Hans Rossel - www.koba.be
Zoekbox
<?php if ($search_box): ?>
 <div class="search-box">
  <?php print $search_box ?>
 </div>
<?php endif; ?>




                             Informatics   Hans Rossel - www.koba.be
Drupal zaken
<?php if ($help): print $help; endif; ?>
$help: Dynamische help tekst van admin pagina's

<?php if ($messages): print $messages;
 endif; ?>
$messages: html voor status, fouten en waarschuwingen, fouten hierin
  uit te schakelen via foutrapportage



Screenshot.png
http://drupal.org/node/11637



                                  Informatics      Hans Rossel - www.koba.be
Doctype & Head
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//
  EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?
  php print $language->language; ?>" lang="<?php print
  $language->language; ?>" dir="<?php print $language-
  >dir; ?>">


<title><?php print $head_title; ?></title>
<?php print $head; ?>




                               Informatics   Hans Rossel - www.koba.be
Footer
$feed_icons: RSS feed ikoontjes voor de huidige pagina
$footer_message: Voetbericht zoals ingesteld bij
websitegegevens
$footer : De voet region zoals gedefinieerd in template.php.
$closure: Eind html van modules die de pagina gewijzigd
hebben. Moet altijd na op het einde komen na alle andere
dynamische content. Problemen met javascript als deze
variabele vergeten wordt.




                              Informatics    Hans Rossel - www.koba.be
page.tpl.php: identiteit
$front_page: url van de homepage, inclusief de
taalprefix of taaldomein
$logo: Pad naar logo image, zoals opgeladen in admin/
build/themes/settings
$site_name: Naam van de site, zoals ingesteld in
websitegegevens
$site_slogan: Slogan van de site, zoals ingesteld in
websitegegevens
$mission: Missie van de site, zoals ingesteld in
websitegegevens

                            Informatics   Hans Rossel - www.koba.be
STAP 4: Javascript
In .info file:
scripts[] = myscript.js

Oude methode (d5):
in template.php via
vb: drupal_add_js(drupal_get_path('theme', 'abc') . '/myscripts.js',
'theme')

In page.tpl.php:
<?php print $scripts; ?>




                                     Informatics       Hans Rossel - www.koba.be
Een nieuw theme ontwerpen

         METHODE 2:
Een subtheme van het Zen theme




              Informatics   Hans Rossel - www.koba.be
ZEN Theme
www.drupal.org/project/zen
Net als Garland gebaseerd op de
http://www.positioniseverything.net/articles/jello.h
Jello Mold techniek
Voordelen
Enorm goede documentatie in comments
Extra functies (theme settings, block editing)
Perfect full option hackable via subtheme

                          Informatics   Hans Rossel - www.koba.be
Een Zen subtheme -
          #226507
Kopieer STARTERKIT en hernoem het
.info: mijntheme.info + verwijzingen
CSS
layout-liquid.css of layout-fixed.css → layout.css
zen.css → mijntheme.css
Optie: html-elements.css + ;weghalen uit .info file
Kopieer tpl.php files indien gewenst


                          Informatics   Hans Rossel - www.koba.be
Een nieuw theme ontwerpen

             METHODE 3:
Hacken via subtheme van bestaand theme




                  Informatics   Hans Rossel - www.koba.be
Een subtheme maken
Maak een map met naam van de theme
morelli.info (#171205)
name = Morelli
Description = Mooi theme
Version = 1.0
Core = 6.x
Base theme = garland
stylesheets[all][] = morelli.css

                            Informatics   Hans Rossel - www.koba.be
DYNAMISCH THEMEN
Theme wijzigen volgens voorwaarden




                Informatics   Hans Rossel - www.koba.be
Dynamisch sturen
 Diverse mogelijkheden
Via css: oa $body_classes
Via block visibility settings
Via dynamische variabelen
Via meerdere templates: volgens url, user,
content type
Intercept & override variables


                      Informatics   Hans Rossel - www.koba.be
Drupal paden, classes voor css

Standaard: node/nid
Opvragen via:
http://api.drupal.org/api/function/arg/6
Voorbeeld
Drupal path: node/11
<?php print arg(0); ?> geeft node
<?php print arg(1); ?> geeft 11
<?php if (arg(2) == 'edit') { echo $content; }

                        Informatics   Hans Rossel - www.koba.be
URL Aliassen opvragen
Zie: http://api.drupal.org/api/function/drupal_get_path_alias/6 en
   http://www.php.net/manual/en/reserved.variables.get.php

<?php
    // $_GET['q'] geeft node/nid en explode() splitst de string op bij '/' en plaatst de stukken in een array

    $path_pieces = explode('/', drupal_get_path_alias($_GET['q']));

    // dus als het pad is /abc/def, $path_pieces is dan Array ( [0] => abc, [1] => def )

    // Dus, $path_pieces[0] geeft 'abc'

 print $path_pieces[0];
?>
vb andere headers volgens content indien pathauto blogs of block visibility settings
<body class="<?php print $body_classes . ' ' . $path_pieces[0]; ?>">
body.node-type-blog #header, body.page-nl-blogger-list #header, body.blogs #header,
   body.blog #header {
    background-image:url(images/blogheader.jpg);
}
                                                       Informatics                Hans Rossel - www.koba.be
PATHAUTO

Download:
http://drupal.org/project/pathauto
Doel:
Automatische urls
Hackable urls: http://drupal.org/node/247205
Sturen: vb op basis van url themen
Afstellen
i18n-ascii.txt bestand (niet vergeten bij update)
Bulk delete en bulk generate aliassen
                          Informatics   Hans Rossel - www.koba.be
Spelen met blokken
Volgens url
www.drupal.org/project/pathauto
Zichtbaarheid voor blog/*, videos/*, nieuws/*
Volgens rol
Admin blokken: redactie, who's online, statistieken
Php zichtbaarheid
Enkel voor bepaalde ct's


                           Informatics   Hans Rossel - www.koba.be
Block visibility settings:
$match = FALSE;
                        php
$types = array('onderwijsmap' => 1, 'campagne' => 2); //Inhoudstypes waarvoor we het blok willen tonen

if (arg(0) == 'node' && is_numeric(arg(1))) {

    $nid = arg(1);

    $node = node_load(array('nid' => $nid));

    $type = $node->type;

    if (isset($types[$type])) {

        $match = TRUE;

    }

}

$url = request_uri();

if (strpos($url, "wat-we-doen")) { //url waarvoor we het blok willen tonen, dus wat-we-doen/*

    $match = TRUE;

}

return $match;

Meer: http://drupal.org/node/134425

                                                               Informatics                      Hans Rossel - www.koba.be
Extra page.tpl.php files
Vorm: page-url-stukjes.tpl.php
Handig, lijkt goed op html templating, maar
vermijden indien mogelijk
Onderhoudbaarheid: header en
footergedeelte via includes




                      Informatics   Hans Rossel - www.koba.be
Meerdere page.tpl.php
                files
Frontpage page-front.tpl.php
Voor node pad (url)
Page-node-edit.tpl.php of page-node-add.tpl.php > page-node-1.tpl.php
  > page-node.tpl.php > page.tpl.php

Volgens users
page-user-1.tpl.php

Volgens url (view of module)
page-blog-tpl.php, page-viewpagename.tpl.php, page-node-add.tpl.php,

page-admin.tpl.php, page-admin-build-block.tpl.php, page-civicrm.tpl.php, page-googlemap.tpl.php, ...

Let op: volgens url niet voor node aliassen, steeds Drupal path vb node/
   2

                                                       Informatics                Hans Rossel - www.koba.be
Page.tpl.php extra
Via preprocess functie in template.php kan
ondersteuning toegevoegd worden voor
page.tpl.php bestanden voor aliassen en
voor taxonomy




                      Informatics   Hans Rossel - www.koba.be
Dynamische variabelen
Deze variabelen zijn beschikbaar voor alle template files, zie theme.inc
$id: positie van de template. Telkens de template is gebruikt, wordt dit cijfer verhoogd met 1.
    Gedefinieerd als $variables['id'] = $count[$hook]++;

$zebra: odd of even, wisselt telkens de template wordt gebruikt.
    Gedefinieerd als $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';

$directory: het pad van de theme tov de base van de installatie: vb "sites/all/themes/myTheme".
    Gedefinieerd als $variables['directory'] = path_to_theme();

$is_admin: TRUE als de bezoeker een site administrator is.
    Gedefinieerd als $variables['is_admin'] = user_access('access administration pages');

$is_front: TRUE als de frontpage van de site wordt bekeken. Gebruiken als alternatief voor
    page-front.tpl.php. De homepage is standaard /node (=promoted to frontpage teasers) of
    zoals ingesteld op admin/settings/site-information.
    Gedefinieerd als $variables['is_front'] = drupal_is_front_page();

$logged_in: TRUE als de bezoeker ingelogd is.
    Gedefinieerd als $variables['logged_in'] = ($user->uid > 0);)

$user: Het volledige user object met de data van de huidige bezoeker. Sommige data kan
   onveilig zijn, dus moet in check_plain verpakt worden (of t functie) vooraleer weergegeven.
$base_path: Basis url van de Drupal installatie, meestal /


                                                           Informatics             Hans Rossel - www.koba.be
Variabelen opvragen
In een template file
<?php
print_r(get_defined_vars());
?>



Via Devel module: excecute php block
dsm($node);




                               Informatics   Hans Rossel - www.koba.be
Node en User Object
Node object                    User object
<?php print_r($node); ?>       <?php print_r($user); ?>
<?php                          <?php
  var_export($node); ?>          var_export($user); ?>
<?php                          <?php var_dump($user); ?
  var_dump($node); ?>            >

Veiligheid:                    Veiligheid
check_url($front_page);
                              check_url($user → ...);
check_plain($node->body);
                              check_plain($user → name);
check_markup($node->body);
                             Informatics    Hans Rossel - www.koba.be
Theme Security
Gevaren: xss, …
Functies ter beveiliging




                       Informatics   Hans Rossel - www.koba.be
Toegangsrechten
global $user;


if (!user_access('toegang tot mijn code'))
{print "Geen toegang tot mijn code"; }


if (in_array('hoofdredactie',$user->roles) || ($user->uid == 1))
{print “Code die alleen mensen met rol hoofdredactie of user nr 1 zien”; }
<!--
<?php print_r($node); ?>
-->


                                      Informatics       Hans Rossel - www.koba.be
User zaken
<?php

global $user;

$uid = $user->uid;

    if (!in_array("lid", $user->roles)){

        print '<a href="/word-lid">Word lid </a>';

}

if ($uid) {

    Print 'Welkom, je bent nu ingelogd als ';

    print $user->name;

    print '<a href="/logout"> Uitloggen</a>';

    }

?>



                                                     Informatics   Hans Rossel - www.koba.be
Node object laden
Voor execute php in devel
<?php
if (arg(0) == 'node' && is_numeric(arg(1))) {
    $node = node_load(arg(1));
    print_r($node);
}
?>



                            Informatics   Hans Rossel - www.koba.be
Node controleren
function phptemplate_preprocess(&$variables, $hook) {
    global $theme;


    $variables['ifnode'] = ( (arg(0) == 'node') && is_numeric(arg(1)) ) &&
     (arg(2) != 'edit' || arg(2) != 'delete');
}




                                        Informatics       Hans Rossel - www.koba.be
$user_agent = $_SERVER['HTTP_USER_AGENT'];

    if($user_agent) {



                            Browser controleren
        if (strpos($user_agent, 'MSIE')) {

            $body_classes[] = 'browser-ie';

        } else if (strpos($user_agent, 'MSIE 6.0')) {

            $body_classes[] = 'browser-ie6';

        } else if (strpos($user_agent, 'MSIE 7.0')) {

            $body_classes[] = 'browser-ie7';

        } else if (strpos($user_agent, 'MSIE 8.0')) {

            $body_classes[] = 'browser-ie8';

        } else if (strpos($user_agent, 'Firefox/2')) {

            $body_classes[] = 'browser-firefox2';

        } else if (strpos($user_agent, 'Firefox/3')) {

            $body_classes[] = 'browser-firefox3';

        }else if (strpos($user_agent, 'Safari')) {

            $body_classes[] = 'browser-safari';

        } else if (strpos($user_agent, 'Opera')) {

            $body_classes[] = 'browser-opera';

        }

    }

    $vars['body_classes'] = implode(' ', $body_classes); // Concatenate with spaces

}


                                                                                      Informatics   Hans Rossel - www.koba.be
Submitted
Standaard:
<?php if ($submitted): ?>
      <?php print $submitted; ?>
<?php endif; ?>

Beter
<?php if ($submitted): ?>
   <div class="submitted">
      <?php print t('Door ') . theme('username', $node) . t(' - Ingediend op ') .
    format_date($node->created, 'custom', "F jS, Y"); ?>
   </div>
<?php endif; ?>



                                                  Informatics             Hans Rossel - www.koba.be
Preprocess functies
Opvolger van                                   function phptemplate_preprocess_page(&$vars) {
  _phptemplate_variables() in Drupal               $vars['tabs2'] = menu_secondary_local_tasks();
  5
Zie ook: Preprocess functions               // Hook into color.module
   http://drupal.org/node/223430
   http://api.drupal.org/api/function/template_preprocess/6
                                            if (module_exists('color')) {
                                                       _color_page_alter($vars);
                                                   }
                                               }




                                              Informatics                 Hans Rossel - www.koba.be
Taxonomy theming
The value of $terms is generated in the theme layer so it's

http://api.drupal.org/api/function/template_preprocess_node/6

First, a $taxonomy variable is created with: $variables['taxonomy'] =

taxonomy_link('taxonomy terms', $node);

The value of $terms is created with: $variables['terms'] =

theme('links', $variables['taxonomy'], array('class' => 'links inline'));



Check out the theme_links doc (http://api.drupal.org/api/function/theme_links/6). If you can't add

your CSS the way you want to using the $attributes parameter, you'll need to create a custom function.




                                                                  Informatics              Hans Rossel - www.koba.be
ANDERE TEMPLATE BESTANDEN




            Informatics   Hans Rossel - www.koba.be
node.tpl.php: algemeen
$title: de titel van de pagina
$content: Node body of teaser afhankelijk van de $teaser vlag.
$picture: foto van de auteur, zoals ingesteld in mijn account na toelating op
admin/user/settings, opgemaakt volgens theme_user_picture().
$date: Themed datum van aanmaak (gebruik $created om te herformatteren met
format_date()).
$links: Themed Links al "Lees meer", "Reactie toevoegen", ... opgemaakt volgens
theme_links().
$name: Themed gebruikersnaam van auteur van theme_user().
$node_url: directe url van de huidige node.
$terms: Themed links van taxonomie termen opgemaakt volgens theme_links().
$submitted: Themed indieninformatie opgemaakt volgens theme_node_submitted().




                                              Informatics            Hans Rossel - www.koba.be
node.tpl.php: andere
$node: Volledige node object, kan data bevatten die niet veilig is. Zie
http://drupal.org/node/28984
$type: Node type, i.e. story, page, blog, etc.
$comment_count: Aantal comments bij deze node
$uid: User ID van de auteur van de node.
$created: Unix tijdsstamp van het tijdstip waarop de node was gepubliceerd.
$zebra: Geeft "even" of "odd". Voor zebra striping in teaser listings.
$id: Positie van de node, neemt toe met 1 telkens een node wordt weergegeven,
vb om op de homepage lijst van promoted to frontpage content het eerste item
$id=1 anders te themen.




                                          Informatics         Hans Rossel - www.koba.be
node.tpl.php: status
$teaser: Vlag voor teaser status.
$page: Vlag voor full node status.
$promote: Vlag voor 'aangeraden op de voorpagina' status
$sticky: Vlag voor vastgeplakt bovenaan de lijst status
$status: Vlag voor publicatie status
$comment: Vlag voor comment setting van de node
$readmore: Vlag geeft true als de volledige hoofdcontent van de pagina
is groter dan het ingekorte teaser gedeelte.
$is_front: Vlag geeft true als in frontpage.
$logged_in: Vlag geeft true als de huidige gebruiker is ingelogds
$is_admin: Vlag geeft true als de huidige gebruiker een administrator is.

                                       Informatics    Hans Rossel - www.koba.be
Blocks in node.tpl.php
Blokken worden normaal geprint in
page.tpl.php.
Soms liever printen in node.tpl.php
vb: Bij het weergeven van $content_bottom
views staan links fout




                     Informatics   Hans Rossel - www.koba.be
Blocks in subthemes
function phptemplate_preprocess(&$variables, $hook) {
    $variables['node_region'] = theme('blocks', 'node_region');
}


Voor subthemes (oa Zen)
function subtheme_preprocess_node(&$variables) {
    $variables['node_region'] = theme('blocks', 'node_region');
}



                                 Informatics    Hans Rossel - www.koba.be
Meerdere node.tpl.php
Volgens content type
node-blog.tpl.php
node-forum.tpl.php
node-page.tpl.php
node-ccknieuwsbericht.tpl.php




                            Informatics   Hans Rossel - www.koba.be
Block.tpl.php
Opsplitsen in meerdere
Moduleblok: block-modulename-delta.tpl.php >
block-modulename.tpl.php > block-region.tpl.php >
block.tpl.php
Eigen blok: block-block-bloknummer.tpl.php
Voorbeeld
block-user-2.tpl.php
block-user.tpl.php
block-left.tpl.php

                        Informatics   Hans Rossel - www.koba.be
Nieuwe tpl.php bestanden
Naast comment en box sinds Drupal 6: in mapje van
core en andere modules
Override = Kopiëren naar theme map + aanpassen
Via Theme Developer (Devel)




                         Informatics   Hans Rossel - www.koba.be
THEME FUNCTIES




      Informatics   Hans Rossel - www.koba.be
Theme overrides




         Informatics   Hans Rossel - www.koba.be
Intercept & override
Basisprincipe: core niet hacken
Niet akkoord met de html en css?
  Css: css door core gedefinieerd overriden in
    style.css of andere .css bestanden (via .info).
    http://www.drupalcoder.com/story/495-
    overriding-css-stylesheets-in-drupal-themes
Html:
Template files: zie eerder
theme overrides: html die wordt gegenereerd door de
modules theme_... functies

                            Informatics   Hans Rossel - www.koba.be
Theme functies zoeken
Lijst: http://api.drupal.org/api/group/themeable/6
Themable functies vinden theme_
Zoeken api.drupal.org (core) of
http://api.freestylesystems.co.uk/api/6 (contibuted)
of eigen via http://drupal.org/project/api
In een .module file: zoeken naar theme_...




                            Informatics   Hans Rossel - www.koba.be
Theme functies overriden
Overriden in template.php
Phptemplate_...: voor alle themes
Mytheme_...: voor mytheme (veiliger)




                        Informatics    Hans Rossel - www.koba.be
IMAGE CACHE THEMING




         Informatics   Hans Rossel - www.koba.be
On the fly creation:
                          Image cache
/PATH/TO/files/imagecache/YOUR_PRESET_NAME/YOUR_FILE_PATH
<?php
print '<img src=”'
       .
      check_url('/sites/default/files/imagecache/YOUR_PRESET_NAME/files/YOUR_FILE_PATH')
       . '“>';
?>
Voorbeeld
sites/default/files/imagecache/PaginaVasteBreedte/afbeeldingen/fotos/sized_Tajine_0.JPG
http://www.example.com/sites/default/files/imagecache/width200/fotos/zonsondergang.jpg
$output .= '<img src="/';
     $output .= 'files/imagecache/bloggers70x70/';
     $output .= $user_info->picture;
     $output .= '" />';

                                                 Informatics        Hans Rossel - www.koba.be
Theming Image Cache
<?php print_r($field_fotoveldnaam); ?>


$foto = theme('imagecache','resize310208',
   $node->field_fotoveldnaam[0]['filepath']);
print $foto;
of
print '<img src=”' . $base_path .
   'sites/default/files/imagecache/resize310208/files/fotomap/
   '.
   $node->field_fotoveldnaam[0]['filename'] . '”
   id=”gallery_big” alt=”' . $title . '” title=”' . $title . '” />”';

                                  Informatics     Hans Rossel - www.koba.be
LOGIN FORM THEMING




        Informatics   Hans Rossel - www.koba.be
Login form theming
Zie




  http://thefaultandfracture.blogspot.com/2009/04/theming-drupal-user-login-form.html




                                              Informatics            Hans Rossel - www.koba.be
Css wisselen
function [themename]_preprocess_node(&$vars, $hook) {
 if ($vars['type'] == 'adcoupon') { // Node type is 'adcoupon'
drupal_add_css(drupal_get_path('theme','[themename]').'/adcoupon.css','them
e');
}

In this case the node type (adcoupon) is actually a cck type. I have
the specific css file in the theme directory.




                                       Informatics         Hans Rossel - www.koba.be
BASIS THEME FUNCTIES




         Informatics   Hans Rossel - www.koba.be
Theme developer




         Informatics   Hans Rossel - www.koba.be
Themeable functions
http://api.drupal.org/api/group/themeable/6




                      Informatics   Hans Rossel - www.koba.be
L functie: een link maken
http://api.drupal.org/api/function/l/6
Vorm: l($text, $path, $options = array());
Eenvoudig voorbeeld
l(t('klik hier'), “node/1”);
Voorbeeld uit blog module
l(t('View recent blog entries'), "blog/$user->uid",
   array('attributes' => array('title' => t("Read @username's
   latest blog entries.", array('@username' => $user-
   >name)))));



                                 Informatics   Hans Rossel - www.koba.be
theme_item_list: een lijst
http://api.drupal.org/api/function/theme_item_list/6
Vorm: theme_item_list($items = array(), $title = NULL, $type = 'ul',
$attributes = NULL)
Voorbeeld
<?php
$items = array('jan','piet','joris');
print theme('item_list', $items, NULL, 'ul', array('class' => 'mijn-
lijst', 'id' => 'de-lijst'))
?>




                                   Informatics       Hans Rossel - www.koba.be
theme_table
http://api.drupal.org/api/function/theme_table/6
Vorm: theme_table($header, $rows, $attributes = array(),
$caption = NULL)
Voorbeelden: zie http://drupal.org/node/156863




                               Informatics    Hans Rossel - www.koba.be
theme_links
http://api.drupal.org/api/function/theme_links/6
Vorm: theme_links($links, $attributes = array('class' =>
'links'))
Voorbeeld
theme('links', $primary_links, array('class' => 'links primary-
links', 'id' => 'primary'))




                                Informatics    Hans Rossel - www.koba.be
HOMEPAGE




   Informatics   Hans Rossel - www.koba.be
Homepage theming
(via wysiwyg)
Standaard Drupal met blokken en extra
regions
Als eigen content type
Als page-front.tpl.php
Via Panels



                     Informatics   Hans Rossel - www.koba.be
Permissies
If ($logged_in) {…}
If (!$logged_in) {…}
If ($is_admin) {…}
If (in_array('redactie'), array_values($user-
>roles)) {...}




                       Informatics   Hans Rossel - www.koba.be
THEME SWITCHING (ADVANCED)




            Informatics   Hans Rossel - www.koba.be
<?php


             Wisselen van theme
/** * Implementation of hook_menu (D5 code) */

function SOMEMODULE_menu($may_cache) {

if (!$may_cache) {

if ($theme = $_GET['theme']) {

$themes = list_themes();

if (isset($themes[$theme])) {

$GLOBALS['custom_theme'] = $theme;

}

}

}

}

?>

With this you can amuse yourself by browsing to /node/1?theme=marvin



I was thinking this could actually be useful- for example you could make an all xml theme and have Flash get data from
     path/to/page?theme=xml_theme


                                                            Informatics                 Hans Rossel - www.koba.be
Theme op basis van url
In settings.php

// if the url is an administration page
if (strpos($_GET['q'], 'admin') === 0) {
    $conf['theme_default'] = 'garland';
}
<?php
$args = explode('/', $_GET['q']);
if ($args[0] == 'admin') {
    $GLOBALS['custom_theme'] = 'mytheme/admin';
}
?>
                                             Informatics   Hans Rossel - www.koba.be
Nog code
Zie http://drupal.org/node/26357

$parts = explode('.',
   $_SERVER['HTTP_HOST']);
if ($parts[0] == 'mobile') {
    $GLOBALS['custom_theme'] = 'mobile';
}


                      Informatics   Hans Rossel - www.koba.be
Theme switching modules
http://drupal.org/project/switchtheme

http://drupal.org/project/role_theme_switcher

http://drupal.org/node/86751




                                                Informatics   Hans Rossel - www.koba.be
BACKUPS, ONDERHOUD & UPGRADES




              Informatics   Hans Rossel - www.koba.be
Databasestructuur

Via phpmyadmin
Cache
Nodes
Terms
Users




                 Informatics   Hans Rossel - www.koba.be
Nuttige acties

Paswoord en email wijzigen van user 1
Een slechte module uitschakelen
Een blok met foute php code uitschakelen
Cache tabellen leegmaken
Access log leegmaken
Optimize tables




                     Informatics   Hans Rossel - www.koba.be
BACKUP DATABASE




       Informatics   Hans Rossel - www.koba.be
BACKUP FILES

Vooral de map sites is van belang, met de
map files in het bijzonder
Ftp 2000 files max




                     Informatics   Hans Rossel - www.koba.be
Backup modules & info
Handbook: http://drupal.org/node/22281
http://drupal.org/project/backup_migrate
Beste en actiefste backup module op dit ogenblik
Scheduled backup
Excluden van grote tabellen: search, cache, sessions
http://www.ozerov.de/bigdump.php: grote databases




                             Informatics   Hans Rossel - www.koba.be
Upgraden: puntupgrade
Stap 1: Backup sites & database
Stap 2: Inloggen als user 1 + Offline mode
Stap 3: Alle bestanden verwijderen, behalve sites.
Stap 4: Nieuwe bestanden in de plaats zetten
Stap 5: Patches herinstalleren
Stap 6: update.php laten lopen
Stap 7: patches herinstalleren
Stap 8: controle installatie en logs




                              Informatics   Hans Rossel - www.koba.be
Diff & Patch

www.drupal.org/patch
Cygwin
Linux omgeving in Windows
http://www.cygwin.com
Nut bij Drupal: diff, patch en cvs
Screencast: http://www.lullabot.com/node/280/play

Patching
Screencast:
http://e4.video.blip.tv/1540000325302/Add1sun-
RollingPatchesInDrupal517.mov



                                     Informatics    Hans Rossel - www.koba.be
Automatische updates
http://groups.drupal.org/aegir-hosting-system
    Hosting systeem voor meerdere Drupal sites
   Bevat Drush en Dashboard
http://drupal.org/project/plugin_manager
    Zit bij Drupal 7 in core




                             Informatics   Hans Rossel - www.koba.be
Drush: Drupal Shell
http://drupal.org/project/drush (ook voor windows)
   http://vimeo.com/5207683
   Extra http://drupal.org/taxonomy/term/4654
   http://www.archive.org/details/DrupalconSf2010Drush
   http://www.archive.org/details/DrupalconSf2010AdvancedDrush




                                    Informatics          Hans Rossel - www.koba.be
Drush commando voorbeelden
Drupal installeren in htdocs of www mapje
   drush (help uitleg)
   drush dl drupal (download drupal)
   drush dl cck views nl ckeditor acquia_marina backup_migrate (in drupal map)
   drush en cck views (modules aanleggen, omgekeerd: dis)
   drush cron

Drupal updaten met drush
   drush bam backup of drush sql-dump > example10052010.sql
   tar -czf drupal.tgz drupal
   drush variable-set site_offline TRUE
   drush up: update alle modules + backup code
   drush updb: run update.php
   drush variable-set site_offline FALSE

                                           Informatics        Hans Rossel - www.koba.be
Drush make

Drush make: bundelen van de
  automatisaties
Installeren: drush dl drush_make
Makefile opstellen:
  Drush generate makefile
    /opt/lampp/htdocs/makefiles/example.make
  Drush convert makefile example.make example.make

drush make example.make example (maakt
  een drupal site op /example)

                              Informatics      Hans Rossel - www.koba.be
Drush make structuur
core = 6.x

projects[] = drupal
projects[] = cck
projects[] = views

Uitgebreid voorbeeld:
  http://drupalcode.org/viewvc/drupal/contributions/profiles/openatrium/openatrium.make?revision=1




                                           Informatics            Hans Rossel - www.koba.be
TAXONOMY




   Informatics   Hans Rossel - www.koba.be
Taxonomy

Indelen in
  woordenschatten (taxonomies,
   trefwoordgroepen)
  Termen (trefwoorden)
Beheren > Taxonomy
Extra modules
  Taxonomy manager
  Taxonomy_csv: importeren van trefwoordlijsten
  http://drupal.org/project/modules?
                       Informatics   Hans Rossel - www.koba.be
Taxonomy

Indeling in categorieën
Hierarchie
Free tagging of controlled
Urls of views arguments
Content taxonomy module
Hierachical select module




                             Informatics   Hans Rossel - www.koba.be
Taxonomy

Indeling in categorieën
Hierarchie
Free tagging of controlled
Urls of views arguments
Content taxonomy module
Hierachical select module




                             Informatics   Hans Rossel - www.koba.be
Taxonomy

Indeling in categorieën
Hierarchie
Free tagging of controlled
Urls of views arguments
Content taxonomy module
Hierachical select module




                             Informatics   Hans Rossel - www.koba.be
MEERTALIGE WEBSITES




        Informatics   Hans Rossel - www.koba.be
Multilingual Drupal

Veraalbare delen
  i18n: internationalisation: content
  L10n: localisation: interface
Multilingual settings
  Drupal core: basis functionaliteiten
  Drupal contrib: i18n module: vertalen van
   menu's, blocks, taxonomy, …
Handbook: http://drupal.org/node/324602

                         Informatics    Hans Rossel - www.koba.be
Vertalen core & modules
http://drupal.org/project/Translations
  http://drupal.org/project/nl
  http://drupal.org/project/fr
  Uitpakken in root
Aanleggen modules
  Locale: interface translation
  Content translation: content translation




                          Informatics   Hans Rossel - www.koba.be
Toevoegen talen
Best bij eerste installatie
  Unpack language files in root: translation maps
   with .po files are created
/admin/settings/language
  Toevoegen nieuwe taal
  Import translation: 1 or more .po files
  /admin/settings/language/configure: path prefix with
    language fallback
  /nl/admin/settings/language/edit/nl: edit language: choose
     prefix



                              Informatics     Hans Rossel - www.koba.be
Interface vertalen
/admin/build/translate/search:
   Zoeken naar vertaalbare strings in modules,
     themes, drupal core
   vertaalbaar=verpakt in t('test'); function
http://drupal.org/project/l10n_client: makkelijker
   interface voor vlotte vertaling
Import: /admin/build/translate/import
     Volledig of aparte po bestanden downloaden van
      drupal.org



                          Informatics   Hans Rossel - www.koba.be
Modules
Contributed
   http://drupal.org/project/l10n_client: makkelijker
     interface vertaling
   http://drupal.org/project/i18n: meer opties voor
     content vertaling
Translation server: http://localize.drupal.org
   Export: http://localize.drupal.org/translate/languages/nl/export?project=drupal
   All in one file: po file
   Je eigen translation server: http://drupal.org/project/l10n_server




                                           Informatics            Hans Rossel - www.koba.be
Evenementen




     Informatics   Hans Rossel - www.koba.be
Date views

www.drupal.org/project/date:
  Datum veld toevoegen
  Inhoudstype afwerken voor evenement
View
  Filter opties: Selecteer events > now
www.drupal.org/project/calendar
  Display of calendar block
  Advanced views: argument op juiste datumveld
   zetten

                        Informatics   Hans Rossel - www.koba.be
Fotogallerij met views

Inhoudstype
  Titel en 1 foto veld
  Comments aan
View maken van alle foto's
http://drupal.org/project/custom_pagers:
  volgende vorige links




                         Informatics   Hans Rossel - www.koba.be
Features

www.drupal.org/project/features
  Verpakken van settings als herbruikbare
   module
  Feature servers
http://www.lullabot.com/articles/photo-galleries-v
  Downloaden en in sites/all/modules
  Views Gallery Module activeren
  Nodige dependent modules activeren


                       Informatics   Hans Rossel - www.koba.be
WEBFORM




   Informatics   Hans Rossel - www.koba.be
Webform

www.drupal.org/project/webform
  Uitgebreide contact, bestel, inschrijving,
   enquete formulieren
  Diverse elementen: multistep form, grid, email
  Export naar Excel en statistieken
  Geen views integratie (wel in dev of via extra
   module tijdelijk)
  Minder integratie dan cck



                        Informatics   Hans Rossel - www.koba.be
MULTISITE INSTALLATION




          Informatics   Hans Rossel - www.koba.be
Multisite
Setup:
  Zelfde codebase (Drupal download) voor meerdere websites
  1 aparte database (settings.php) per site (aanbevolen)

Voordelen
  Onderhoud/updating van code is makkelijker (maar 1 codebasis updaten)

Nadeel
  Alle sites moeten op dezelfde snelheid upgedated worden (je kunt
     uitzonderingen maken, maar verliest dan een beetje het voordeel van
     de multisite)
     => Werkt best met gelijkaardige sites

Handbook
  Commentaar in settings.php
  http://drupal.org/getting-started/6/install/multi-site



                                             Informatics   Hans Rossel - www.koba.be
Code structure
Voor een fictieve site op http://www.example.be/mysite/test/, de
  'settings.php' wordt gezocht in de volgende mappen:

sites/www.example.be.mysite.test
sites/example.be.mysite.test
sites/be.mysite.test
sites/www.example.be.mysite
sites/example.be.mysite
sites/be.mysite
sites/www.example.be
sites/example.be
sites/be
sites/default


                                   Informatics       Hans Rossel - www.koba.be
Code structure
sites/all:
    /modules and /themes for all sites
sites/default: settings.php hier is default voor alle sites, niet
   nodig
sites/site1.be
    sites/site1.be/modules: enkele modules die alleen maar
       gebruikt worden op site 1
    sites/site1.be/themes: een of meer themes alleen maar
       gebruikt op site 1
    sites/site1.be/files: bestanden in te stellen bij admin/settings/
       file-system (sites kunnen files sharen; goed nadenken
       over filestructure/permissions op voorhand als je wil
       sharen)
    sites/site1.be/settings.php: database details voor site1.
       Fresh copy of default.settings.php: ga naar elke site om
       de installer te lanceren en I settings.php in te stellen.- www.koba.be
                                     nformatics      Hans Rossel
Setup on server

Cpanel
  Maak “parked domain” site1.be (check domain
   root = /public_html)
  Maak symlink van site1 naar root indien niet zo
   of bij addon domein
Dedicated server
  Setup virtual hosts
  Maak symlink



                        Informatics   Hans Rossel - www.koba.be
Create Virtual Hosts
Belangrijk elk domein moet naar zelfde set Drupal files richten
Setup dns entries for site1.be and site2.be
/etc/apache2/sites-available/ or httpd.conf
Listen 80
<VirtualHost *:80>
  DocumentRoot /absolute/path/to/drupal
  ServerName site.be
</VirtualHost>


<VirtualHost site1.be:80>
  DocumentRoot /absolute/path/to/drupal
  ServerName site1.be
</VirtualHost>
<VirtualHost site2.be:80>
  DocumentRoot /absolute/path/to/drupal
  ServerName site2.be
</VirtualHost>



                                          Informatics      Hans Rossel - www.koba.be
Symlink maken
Zie ook http://drupal.org/getting-started/6/install/multi-site


<?php
/*werkwijze:
* 1. Maak via cpanel een addon of subdomain
* 2. Delete dit subdomain
* 3. Doe de symlink voor dit subdomain/addon vb hieronder voor abc.com waarvoor we
    /abc hebben gedeleted
* De bedoeling is dat de subdomeinen verwijzen naar de root via een symlink
*/
symlink(".", "./abc");


print "Done";
?>



                                                 Informatics     Hans Rossel - www.koba.be
Make symlink with shell access




           ls -s . abc




                Informatics   Hans Rossel - www.koba.be
Onderhoud

Als alle sites dezelfde modules hebben,
  moet je slechts eenmaal update status
  aanzetten
Laat update.php lopen op alle sites




                     Informatics   Hans Rossel - www.koba.be
UBERCART
shopping cart voor Drupal




            Informatics   Hans Rossel - www.koba.be
Ubercart

Project: http://drupal.org/project/ubercart
Hoofdsite: www.ubercart.org
http://www.ubercart.org/docs
http://www.ubercart.org/forum
Vertaling:
http://l10n.privnet.biz/translate/languages/nl of
http://drupal.org/project/l10n_client
Extra plugins
http://www.ubercart.org/contrib
vb http://www.ubercart.org/contrib/140

                           Informatics   Hans Rossel - www.koba.be
Ubercart core modules
Cart (ubercart/uc_cart)
De shopping cart

Order (ubercart/uc_order)
Laat je toe bestellingen te ontvangen

Product (ubercart/uc_product)
Laat je toe producten te maken voor je winkel. Imagecache en cck
Imagefield worden gebruikt om afbeeldingen van producten weer te
geven

Store (ubercart/uc_store)
Laat je toe de winkel te beheren.



                                    Informatics   Hans Rossel - www.koba.be
Andere Ubercart core modules
Attribute (ubercart/uc_attribute)
Geef extra selectiemogelijkheden voor producten. Vb bij verkoop van T-shirts de
grootte selecteren.

Catalog (ubercart/uc_catalog)
Geeft een blok en pagina met producten volgens categorie

File Downloads (ubercart/uc_file)
Voor verkoop van bestanden (software, e-books, foto's)

Notify (ubercart/uc_notify)
Verstuur e-mail verwittigingen naar klanten bij checkout en als ze hun bestelling
wijzigen.



                                        Informatics         Hans Rossel - www.koba.be
Andere core (vervolg)
Payment (ubercart/payment/uc_payment)
Payment API activeren om betalingen te kunnen ontvangen en opvolgen. Alle gerelateerde
modules zitten in de ubercart/payment map.
Reports (ubercart/uc_reports)
Bekijk rapporten van je verkopen, klanten en producten.
Roles (ubercart/uc_roles)
Ken permantente of tijdelijke rollen toe gebaseerd op aankopen.
Shipping Quotes (ubercart/shipping/uc_quote)
Geef transportkosten weer voor klanten bij het uitchecken. Alle gerelateerde modules zitten in
de ubercart/shipping map.
Shipping (ubercart/shipping/uc_shipping)
Zet verzendingen op voor transportbedrijven met geintegreerde webservices.
Taxes (ubercart/uc_taxes)
Bereken tax op bestellingen



                                               Informatics             Hans Rossel - www.koba.be
Extra modules
Google Analytics for Ubercart (ubercart/uc_googleanalytics)
Stuur e-commerce gegevens naar Google Analytics voor rapporten en opvolging.


Importer (ubercart/uc_importer)
Een interface om producten te importeren via XML

Product Kit (ubercart/uc_product_kit)
Maak producten die een verzameling zijn van andere producten. Create products
that represent collections of other products. For example, if you sold TVs, you
could create a collection of CRT, LCD, and Plasma TV products.




                                       Informatics        Hans Rossel - www.koba.be
TOEGANGSCONTROLE




       Informatics   Hans Rossel - www.koba.be
Toegangscontrole modules

Content access of node privacy by role
Taxonomy access
Content field permissions
Masquerade (of devel)




                     Informatics   Hans Rossel - www.koba.be
Organic groups

Online werkgroepen
Mogelijkheid eigen kalender/forum
Open of gesloten
Mail integratie
Toegangsrechten




                     Informatics   Hans Rossel - www.koba.be
IMPORT-EXPORT




      Informatics   Hans Rossel - www.koba.be
Import - Export

Views bulk operations + views bonus: csv
maken
Node import en user import: csv importeren
Advanced modules
http://drupal.org/project/tw
http://drupal.org/project/migrate




                     Informatics   Hans Rossel - www.koba.be
FEEDAPI

http://drupal.org/project/feedapi
http://drupal.org/project/feedapi_comments
Screencasts
http://www.drupaltherapy.com/node/34
http://www.developmentseed.org/sites/default/files/feed_element_mapper_1.swf




                                         Informatics          Hans Rossel - www.koba.be
FEEDAPI + youtube

Nodig
Cck
Feedapi
Feedapi
Feedapi node
Simplepie parser (3rd party)
Feedelement mapper
Feedapi mapper
Feedapi node views
Views
Views bonus
emfield

                               Informatics   Hans Rossel - www.koba.be
SPAM




 Informatics   Hans Rossel - www.koba.be
Spamcontrole

Core: ip blokkeren
Spam module
Voorbeeldweergave
Captchas
Mollom of akismet
Captcha module, recaptcha




                       Informatics   Hans Rossel - www.koba.be
PERFORMANCE




     Informatics   Hans Rossel - www.koba.be
Performance
www.drupal-check.org
Aggregation van js en css
Ongebruikte modules af + db tables wissen
Caching
Gevorderd
Static views
“light” modules
Lijntje code ipv module

Server side:
Memcache
Apache solr
Boost

http://drupal.org/project/advcache
Front side:
Yslow

http://wimleers.com/article/improving-drupals-page-loading-performance
                                            Informatics         Hans Rossel - www.koba.be
VIDEO




 Informatics   Hans Rossel - www.koba.be
Video

Emfield
Flash video & ffmpeg
Kaltura, openvideo
Jquery media
Gewoon cck field
http://drupal.org/project/video_upload

Nieuw: via php stream wrapper
http://drupal.org/project/media
http://www.lullabot.com/drupal-voices/drupal-voices-43-aaron-winborn-media-module
                                               Informatics             Hans Rossel - www.koba.be
ACQUIA




  Informatics   Hans Rossel - www.koba.be
Acquia

http://acquia.com/products-services
http://acquia.com/downloads
http://acquia.com/products-services/acquia-
drupal-modules




                      Informatics   Hans Rossel - www.koba.be
HOOFDSTUK




Wegwijs op drupal.org & drupal.be




               Informatics   Hans Rossel - www.koba.be
Community / drupal.org
Redesign: http://www.disambiguity.com/category/planet-drupal/
Drupal.org
http://groups.drupal.org : themagroepen
http://drupal.org/planet : aggregator Drupal blogs
Www.drupalcon.org




                                   Informatics      Hans Rossel - www.koba.be
Drupal community support
Op drupal.org

http://drupal.org/handbook: handboeken
http://drupal.org/forum: forum
http://drupal.org/project/issues: issues
Op drupal.be

http://www.drupal.be/forum: forum beginner
Binnenkort ook beginners handboek voor ontwikkelaars in Nederlands
IRC

http://drupal.org/irc : Freenode
https://addons.mozilla.org/en-US/firefox/addon/16: Chatzilla
Mailinglijsten

http://drupal.org/mailing-lists: Mailman lijsten


                                                   Informatics   Hans Rossel - www.koba.be
Community in Belgie
www.drupal.be:
Redesign:

wat is Drupal, referenties, showcases, handboek, forum, agenda,... (voorjaar
2009)
http://www.drupal.be/forum/19
Community meetings
Drupal gebruikers groep
drupaljam.nl
Een Drupal ontwikkelaar zoeken/kiezen
Drupal referenties
drupal.org username: http://drupal.org/profile/country/Belgium: gesorteerd op, meritocracy,
lid sinds
drupal.be username:http://drupal.be/profile/profile_kennis/Expert+(gebruik+drupal+dagelijks
): idem sortering, lid sinds
Drupal.be: begin 2009: lijst service providers
                                                 Informatics        Hans Rossel - www.koba.be
Audio & Video
Audio
http://www.lullabot.com/audiocast
http://www.volacci.com/seo-podcast: SEO

Video
http://drupal.org/handbook/customization/videocasts
http://drupal.org/videocasts: video
http://www.drupaltherapy.com: multimedia recepten
http://mustardseedmedia.com/podcast: Voor churches & ministries
http://www.drupaldojo.com/ Community opleiding
http://www.archive.org/search.php?query=drupal%20OR%20drupalcon Drupalcons
Op blip.tv: http://blip.tv/search?q=drupal&x=0&y=0
http://drupalmao.com: gossip
http://movielibrary.lynda.com/html/modPage.asp?ID=620: Tutorials reeks
www.doitwithdrupal.com: van de conferentie dec 2008 (95$)
http://lvb.net/item/7098: FOSDEM februari 2009


                                             Informatics          Hans Rossel - www.koba.be
FREELANCERS




     Informatics   Hans Rossel - www.koba.be
JOBTRENDS




    Informatics   Hans Rossel - www.koba.be
Freelancers
Hoe kan je developers contacteren die tegen betaling customs modules maken en hoe zit het
  dan met de intellectuele eigendom, contaminatieprincipe van OpenSource.


drupal.be: http://drupal.be/support
drupal.org developers van modules + paid services forum
(http://drupal.org/paid-services)
groups.drupal.org: marketplace
http://www.drupaljob.com/
http://www.drupalancers.com/
http://sourceforge.net/services/buy/service_providers.php?words=drupal
http://drupalsn.com/companies
www.getafreelancer.com
http://www.odesk.com




                                            Informatics           Hans Rossel - www.koba.be
Forum

Core forum
Advanced forum module:
  Extra author pane: foto en extra informatie,
   integreert met veel andere social networking
   modules
  User points
  User titles




                       Informatics   Hans Rossel - www.koba.be
NIEUWSBRIEVEN & e-mail integratie




                Informatics   Hans Rossel - www.koba.be
Mail interactie

Simplenews
Subscriptions of Notify of Watcher
Actions & Workflow/Rules & Views Bulk
operations
Messenger & Notifications framework
Webform
Mailhandler



                    Informatics   Hans Rossel - www.koba.be
Nieuwsbrieven

3 voornaamste mogelijkheden
  Simplenews: eenvoudig en goedkoop, geen
    bounce handling, beperkte statistieken
  Campaignmonitor of Mailchimp integratie: full
    bounce handling, statistieken, whitelisting,
    betalend
  Civimail (onderdeel van Civicrm)




                        Informatics   Hans Rossel - www.koba.be
Simplenews
www.drupal.org/project/simplenews
Voor versturen van html mail:
   http://drupal.org/project/htmlmail (Emogrifier helpt)
   http://drupal.org/project/rel_to_abs: absolute paden in links en
      afbeeldingen in body
   Mimemail niet meer gebruiken: bevat bugs en is niet meer
     onderhouden
Extra modules: analytics, on register,...
Let op: geen poormanscron gebruiken (dubbele verzending! + niet
betrouwbare tijdstippen)



                                  Informatics     Hans Rossel - www.koba.be
Nieuwsbrief theming
http://www.campaignmonitor.com/css/
http://drupal.org/node/268404




                    Informatics   Hans Rossel - www.koba.be
Contemplate
http://drupal.org/project/contemplate
In database of sites/all/contemplates
Voordelen:
Geldt voor alle themes (ander niveau dan theme
layer)
Voor search, rss feeds en nieuwsbrieven




                        Informatics   Hans Rossel - www.koba.be
Body & footer
simplenews-newsletter-body--1126.tpl.php
simplenews-newsletter-footer--1126.tpl.php
Velden printen
<?php print $node->field_nieuwsbrief_link1[0]['view']; ?>
$foto = theme('imagecache','square100x100',$node->field_nieuwsbrief_foto1[0]['filepath']);
print '<div class="field-field-foto">' . $foto . '</div>';
<?php print $node->field_nieuwsbrief_intro[0]['view']; ?>




                                              Informatics          Hans Rossel - www.koba.be
JQUERY




  Informatics   Hans Rossel - www.koba.be
Jquery
Voordelen
Unobtrusive
Klein en licht
Trekt goed op css, eenvoudig te leren
Browser compatibiliteit
In Drupal core, wederzijds verbonden met Drupal
Concurrenten
MooTools, Prototype/Scriptaculous
Let op: conflicten en performance bij 2 frameworks


                              Informatics   Hans Rossel - www.koba.be
Populairiteit jquery groeit




                                     B:
http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx

                                                                   Bron:
http://www.google.com/trends?q=jquery%2C+mootools%2C+yahoo+ui%2C+dojo+(toolkit%7Cjavascript%7Clibrary%7Cframework)%2C+prototype+(toolkit%7Cjavascript%7Clibrary%7C

                                                                        Informatics                           Hans Rossel - www.koba.be
Jquery
Nadelen
In sommige tests & Browsers trager dan de
concurrenten
In snelle evolutie waardoor de met Drupal core
geleverde versie niet meer up-to-date is. Drupal 6.0
to 6.2 hebben jQuery 1.2.3. Vanaf Drupal 6.3 was
dit jQuery 1.2.6 (laatste versie). Andere optie:
http://drupal.org/project/jquery_update, maar
Eigenlijk een core hack (misc folder aanpassen)
Versie en compatibiliteitsproblemen

                             Informatics   Hans Rossel - www.koba.be
Jquery toevoegen
http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet
scripts.js maken in theme map met
$(document).ready(
 function() {
   $(‘p’).hide(‘slow’);
   });
In template.php
drupal_add_js(path_to_theme().‘scripts.js’, ‘theme’, ‘header’);
of via .info file toevoegen aan theme map
Jquery wordt automatisch geladen bij drupal_add_js
                               Informatics     Hans Rossel - www.koba.be
Voorbeelden




       Informatics   Hans Rossel - www.koba.be
Core functionaliteit




http://www.simonwhatley.co.uk/blog/wp-content/uploads/2008/02/jquery12_api_reference.png
                                               Informatics            Hans Rossel - www.koba.be
Meer jquery
http://docs.jquery.com
http://api.drupal.org/api/function/drupal_add_js/6
http://learningjquery.com
http://ajaxian.com/archives/hacking-digg-with-firebug-and-jquery




                               Informatics    Hans Rossel - www.koba.be
Jquery plugins
http://plugins.jquery.com/
Drupal Jquery pluging manager
http://drupal.org/project/jquery_plugin
http://drupal.org/project/jqp
http://drupal.org/project/jq
Drupal 7 in core: http://drupal.org/node/315100




                         Informatics   Hans Rossel - www.koba.be
PRAKTIJK




   Informatics   Hans Rossel - www.koba.be
Bekijken installaties
Welk is de gebruikte methode om je homepagina een
andere layout te geven dan je onderliggende pagina's?
Meerdere websites hosten vanop één drupal installatie.
Principe van dynamisch themen.




                          Informatics   Hans Rossel - www.koba.be
Drupal 7: Nieuw

Betere installer
Paswoord encryptie: betere bescherming
  van rainbow tables
Ingebouwde automatische module en theme
  installer en updater
Verbeterde meertaligheid
Verbeterde tijdzone support
PHP stream wrappers
Javascript overlays (jquery ui in core)
                   Informatics   Hans Rossel - www.koba.be
Drupal 7: Usability & UX

Wat?
 Gebruiksvriendelijkheid
  “Given two functionally equivalent content
  management systems, the simplest one should
  be selected.” (http://buytaert.net/ockhams-razor-
  principle-of-content-management-systems)
 Reactie op “van developers voor developers” imago
  & tests in 2008 van University Minnesota (
  http://buytaert.net/first-results-from-usability-testing
  )
 Mark Bolton: Redesign van drupal.org en UX
  Drupal 7.
                          Informatics    Hans Rossel - www.koba.be
Drupal 7: Database laag

Wat?
  Drupal gebruikt nu de php pdo (php data
   objects) database abstractielaag
Voordeel?
  Drupal zal niet enkel op MySQL/PostGreSQL
   kunnen draaien maar ook op MSSQL, Oracle,
   SQLite, …
  Microsoft (hoofdsponsor Drupalcon SF 2010)
   reageerde positief en sponsorde alvast de
   afwerking van de MSSQL pdo en de
   corresponderende Drupal module
  Master slave en transactionmsupport
                           Infor atics
                                   Hans Rossel - www.koba.be
Drupal 7: Unit testing

Wat?
  Automatische tests:
    http://drupal.org/node/363580#comment-2665246
  18202 tests automatisch uitgevoerd
  http://qa.drupal.org/pifr/test/35713
Voordeel




                      Informatics   Hans Rossel - www.koba.be
Drupal 7: Semantic web

Wat?
  Het toevoegen van betekenis (semantiek) aan data
   door machines wordt gedaan door deze met
   ontologieën, beschrijvingen van concepten en de
   relaties daartussen, in metadata uit te breiden. Zo
   kunnen er automatisch relaties tussen concepten
   gelegd worden. Het W3C heeft hiervoor onder andere
   de RDF-standaard (Resource Description
   Framework) ontwikkeld.
  Automatisch toevoegen van RDFa data aan de html van
   Drupal: auteursinformatie, indiendatum, ...

Voordeel?
  Met SPARQL & FOAF verbanden leggen tussen data
                          Informatics   Hans Rossel - www.koba.be
Drupal 7: Fields in core

Wat?
  CCK in core, was een van de
   basiscomponenten van uitgebreidere sites
Voordeel?
  Stabielere basis
  Conceptueel geabstraheerd: fields op content,
    taxonomie, users, elk object door module
    gedefinieerd (hoeft niet in mysql te zitten)
  Vb The Examiner: MongoDB dank zij Fields API
  Combinatie met Views3 query builder is zeer
    krachtig.s
                       Informatics   Hans Rossel - www.koba.be
Drupal als Product
    Distributies & Installatieprofielen
Probleem:
Een basisinstallatie van Drupal heeft geen
  full-option mogelijkheden (low-end kritiek).
Drupal mag niet te zwaar zijn, enkel
  noodzakelijke in core, moet vooral
  bruikbaar zijn als framework (high-end
  kritiek).

Oplossing: Distributies/Installatieprofielen
 aangepast aan doelgroep
                       Informatics   Hans Rossel - www.koba.be
Drupal 7 Demo




      Informatics   Hans Rossel - www.koba.be
Wordt vervolgd...
 hans.rossel@koba.be
    Twitter: @haro
    www.koba.be




          Informatics   Hans Rossel - www.koba.be

Contenu connexe

Similaire à Drupal Cursus Hans Rossel

Drupal intro 2010
Drupal intro 2010Drupal intro 2010
Drupal intro 2010Hans Rossel
 
Introductie Drupal development
Introductie Drupal developmentIntroductie Drupal development
Introductie Drupal developmentBart Hanssens
 
General Drupal presentation in Dutch
General Drupal  presentation in DutchGeneral Drupal  presentation in Dutch
General Drupal presentation in DutchRoel Meester
 
Drupal koba-nov2013
Drupal koba-nov2013Drupal koba-nov2013
Drupal koba-nov2013Hans Rossel
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDavid Coppoolse
 
Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Hoppinger
 
Lucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLuciuswebsystems
 
Wat is drupal? - Drupal seminar 20 mei 2010, Colours
Wat is drupal? - Drupal seminar 20 mei 2010, ColoursWat is drupal? - Drupal seminar 20 mei 2010, Colours
Wat is drupal? - Drupal seminar 20 mei 2010, ColoursColours B.V.
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceguesta83c7d
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceguesta83c7d
 
Headless Drupal - Wat, Waarom, Hoe & Uitdagingen
Headless Drupal - Wat, Waarom, Hoe & UitdagingenHeadless Drupal - Wat, Waarom, Hoe & Uitdagingen
Headless Drupal - Wat, Waarom, Hoe & UitdagingenLuciuswebsystems
 
Lucius Drupal Development Cursus
Lucius Drupal Development CursusLucius Drupal Development Cursus
Lucius Drupal Development CursusLuciuswebsystems
 
Open eGo, innovatie in eGovernment
Open eGo, innovatie in eGovernmentOpen eGo, innovatie in eGovernment
Open eGo, innovatie in eGovernmentBart Gysens
 

Similaire à Drupal Cursus Hans Rossel (20)

Drupal intro 2010
Drupal intro 2010Drupal intro 2010
Drupal intro 2010
 
Introductie Drupal development
Introductie Drupal developmentIntroductie Drupal development
Introductie Drupal development
 
General Drupal presentation in Dutch
General Drupal  presentation in DutchGeneral Drupal  presentation in Dutch
General Drupal presentation in Dutch
 
Drupal koba-nov2013
Drupal koba-nov2013Drupal koba-nov2013
Drupal koba-nov2013
 
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse ErfgoedbibliotheekDrupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
Drupal + Open Atrium bij de Vlaamse Erfgoedbibliotheek
 
Drupal workshop 10-03-2011
Drupal workshop 10-03-2011Drupal workshop 10-03-2011
Drupal workshop 10-03-2011
 
SEO & Drupal CMS
SEO & Drupal CMSSEO & Drupal CMS
SEO & Drupal CMS
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 
Ict Bijscholing
Ict BijscholingIct Bijscholing
Ict Bijscholing
 
Lucius Websystems Drupal Startersdag
Lucius Websystems Drupal StartersdagLucius Websystems Drupal Startersdag
Lucius Websystems Drupal Startersdag
 
Software anno 2009
Software anno 2009Software anno 2009
Software anno 2009
 
Wat is drupal? - Drupal seminar 20 mei 2010, Colours
Wat is drupal? - Drupal seminar 20 mei 2010, ColoursWat is drupal? - Drupal seminar 20 mei 2010, Colours
Wat is drupal? - Drupal seminar 20 mei 2010, Colours
 
Oplijsting mogelijkheden open source
Oplijsting mogelijkheden open sourceOplijsting mogelijkheden open source
Oplijsting mogelijkheden open source
 
oplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_sourceoplijsting_mogelijkheden_open_source
oplijsting_mogelijkheden_open_source
 
Drupalgardens
DrupalgardensDrupalgardens
Drupalgardens
 
Headless Drupal - Wat, Waarom, Hoe & Uitdagingen
Headless Drupal - Wat, Waarom, Hoe & UitdagingenHeadless Drupal - Wat, Waarom, Hoe & Uitdagingen
Headless Drupal - Wat, Waarom, Hoe & Uitdagingen
 
Lucius Drupal Development Cursus
Lucius Drupal Development CursusLucius Drupal Development Cursus
Lucius Drupal Development Cursus
 
Open eGo, innovatie in eGovernment
Open eGo, innovatie in eGovernmentOpen eGo, innovatie in eGovernment
Open eGo, innovatie in eGovernment
 
Open eGo 20090910
Open eGo 20090910Open eGo 20090910
Open eGo 20090910
 
Drupal distros
Drupal distrosDrupal distros
Drupal distros
 

Drupal Cursus Hans Rossel

  • 1. Drupal CMS - v17 hans.rossel@koba.be – Twitter @haro - www.koba.be Informatics Hans Rossel - www.koba.be
  • 2. Wat is Drupal CMF (W)CMS Content Management Content Management Systeem Framework www.drupal.org http://api.drupal.org www.drupal.com hooks, callbacks & overrides www.drupal.be Informatics Hans Rossel - www.koba.be
  • 3. Situering: CMS concurrenten Gesloten: Tridion, Sharepoint, Documentum, Stellent Open source Java: Alfresco, Liferay, OpenCMS Python: Plone (Zope webserver, ZODB) Php: Joomla (Mambo) Wordpress Typo3 Asp: Dotnetnuke Informatics Hans Rossel - www.koba.be
  • 4. Bron: Cmswire Open Source CMS Market Share Report (2009) Informatics Hans Rossel - www.koba.be
  • 5. Trends Open Source CMS www.google.com/trends en www.indeed.com/jobtrends Informatics Hans Rossel - www.koba.be
  • 6. Informatics Hans Rossel - www.koba.be
  • 7. Referenties Media/Entertainment VRT, VTM, VT4, Vitaya, RTBF Sony BMG Music, Universal Music Group, Warner Bros, 20th Century Fox, Michael Jackson, Eric Clapton and Robbie Williams, Grammy awards, Emmy awards The Examiner, The Economist, Le Figaro, Edipresse, Infoworld, Aj Jazeera Studio Brussel, Radio Netherlands Worldwide, Australian Broadcast Company, BBC, CNN, Reuters Virgin, Slate, Monthy Python and Lucas Arts Informatics Hans Rossel - www.koba.be
  • 8. NGO, Gov & edu Human Rights watch, Amnesty World Food Programme, World Bank, United Nations, Europese Unie, World Economic Forum Witte Huis, Vlaanderen, New York state senate, US Department of Commerce, Belgische Premier, Belgische Monarchie, FOD Financiën, the French government, the Dutch government, the Australian Prime Minister and the British Government, London en Athene. Universiteit Gent, Duke University, Strayer University, Portland University, MIT, Stanford University and Harvard UitinVlaanderen, FARO, Louvre, Tate, Vlaamse Kunstcollectie NASA (http://themis.asu.edu/) Linux Foundation, JAVA.net en Internet Systems Consortium Informatics Hans Rossel - www.koba.be
  • 9. Enterprises using Drupal Telenet, ING, Garmnin, Ebay, Symantec, Nokia, AHOLD, Randstad, Sony Ericsson, Paypal, Twitter, Mattel, Nvidia, Rackspace, AT&T, FUJI film, General Motors, Intel, Fujifilm, Fedex, IBM, Cap Gemini, Accenture, Procter & Gamble en Google (mlab), IKEA Zenito (svmb/admb) Meer referenties: http://www.buytaert.net/tag/drupal-sites Informatics Hans Rossel - www.koba.be
  • 10. Voordelen Drupal Open Source GPLv2: broncode vrij downloadbaar en aanpasbaar Geen licentiekosten. Geen Vendor Lock-In. Veel bedrijven. Geen “eenmans” Open Source CMS Grote community & sterke groei: veel support, testen, activiteit Up-to-date, mee met nieuwe ontwikkelingen Php = meest gebruikte webprogrammeertaal Uitvoerig getest: 3.2 miljoen keer/jaar gedownload, grote sites gebruiken het 10000 Modules = Veel kostefficiënte uitbreidingen http://drupal.org/project/Modules Informatics Hans Rossel - www.koba.be
  • 11. Troeven Drupal Kwaliteit code & modulaire uitbreidbaarheid Heel flexibel framework (CMF) met goede stabiele architectuur en code heel geschikt voor maatwerk. Uitgebreide en uitvoerig gedocumenteerde API (api.drupal.org) Social media aspecten “Online community” aspecten al vanaf het prille begin ingebouwd: taxonomie, user rollen, comments.Volwassen functionaliteiten Volledig Open Source GPLv2 (geen “dual licence”) Alle modules vrij downloadbaar (vgl. Joomla), community edition is full option (vgl. Alfresco, SugarCRM). Activiteit en info gecentraliseerd op www.drupal.org (vgl Joomla) Enterprise ready Steeds meer grote referenties => uitvoerig getest, gedocumenteerde integratiemogelijkheden, performance, scaling, caching. Commerciële ondersteuning van het project Acquia, Drupal Association Community & ecosysteem Grote en open community gebaseerd op Open Source principes van samenwerken (vgl Joomla: http://buytaert.net/joomla-vs-drupal-business-models-and-commercial-ecosystem). Veel ontwikkelaars, veel support. Made in Belgium Informatics Hans Rossel - www.koba.be
  • 12. Integratie Drupal DMS: Document management Beperkte reeks modules voor doorzoeken van pdf, word, excel Integratie met Alfresco via CMIS. CRM: Contact Relationship Management Integratie met CiviCRM, SugarCRM, … Knowledge Management Portal (Intranet) Open Atrium Distributie (Wereldbank Intranet) en LDAP integratie modules Project Management Drupal Modules: Storm, Casetracker, Project Webshop Ubercart/Drupalcommerce module of integratie met Magento Webservices SOAP, Rest, XMLRPC, Services module. Informatics Hans Rossel - www.koba.be
  • 13. Geschiedenis 1999 Dries Buytaert Recente versies focus 4.7: Form API, admin interface 5: Mature & Stable, CCK, Views 6: Multilingual support, theming layer 7: Usability (image), Unit testing, php5.2.6, Semantic web, fields API 8: Webservices (Symfony 2, OO php), Configuration management, mobile, html5, design, multilingual. Zie http://groups.drupal.org/drupal-initiatives Informatics Hans Rossel - www.koba.be
  • 14. Omvang Drupal project > 10000 Modules (= plugins, extensies) > 1.6 miljoen pagina's en > 850.000 users op drupal.org Drupal core werd 3.2 miljoen keer gedownload in 2009 en draagt meer dan 600.000 actieve websites (http://drupal.org/project/usage) Twee delen Core: >700 ontwikkelaars (D6), 62 duizend lijnen code (=15 persoonjaren = 837 duizend dollar, bron ohloh.net). Contributed: >1300 ontwikkelaars, 2.6 miljoen lijnen code (=765 persoonjaren = 42 miljoen dollar, bron ohloh.net) 42 talen, >1000 gratis Themes (meer vb Templatemonster, ...) Informatics Hans Rossel - www.koba.be
  • 15. Groei Informatics Hans Rossel - www.koba.be
  • 16. Leercurve developers Informatics Hans Rossel - www.koba.be
  • 17. Community Internationaal www.drupal.org http://planet.drupal.org: Blogs http://groups.drupal.org: Werkgroepen België Www.drupal.be Www.drupal.be/support: Bedrijven Informatics Hans Rossel - www.koba.be
  • 18. Systeemvereisten Standaard Alternatieven Apache Lighttpd IIS mits aanpassingen voor php > MySQL 5.0.15 PostgreSQL > Php 5.2 (+pdo) MSSQL, Oracle via php PDO. Php RAM > 50MB min Informatics Hans Rossel - www.koba.be
  • 22. HOOFDSTUK 2 INSTALLATIE DRUPAL CORE Informatics Hans Rossel - www.koba.be
  • 23. Origineel of voorverpakt Origineel drupal.org Via Windows installer: http://acquia.com/downloads/windows-installer Via controlepaneel: Installatron, Fantastico Drupal gardens Distributies (http://drupal.org/project/distributions) Open Atrium Open Publish Pressflow Nodestream Commerce Kickstart Open Public Informatics Hans Rossel - www.koba.be
  • 24. Systeemvereisten Standaard Alternatieven Apache Lighttpd MySQL 5 IIS mits aanpassingen Php 5.2 (nog geen PostgreSQL 5.3) Sinds D7: nieuwe abstraction layer die andere databases (MSSQL, Oracle) ondersteunt via php PDO. Informatics Hans Rossel - www.koba.be
  • 25. Installatie nodig Hosting of LAMP op localhost > Mysql 5: database > php 5.2: programmeertaal Apache mod rewrite bruikbaar in .htaccess Voldoende geheugen http://drupal.be/documentatie/drupal-hosting Informatics Hans Rossel - www.koba.be
  • 26. Lamp server op Ubuntu (debian) sudo aptitude install php5 apache2 mysql- server phpmyadmin php5-mysql libapache2-mod-php5 php5-cli (voor drush) root user paswoord instellen voor mysql phpmyadmin: spatiebalk drukken om apache2 te kiezen + ok testen: localhost, localhost/phpmyadmin sudo /etc/init.d/apache2 restart Alternatief: sudo tasksel install lamp-server Meer info: https://help.ubuntu.com/community/ApacheMySQLPHP Informatics Hans Rossel - www.koba.be
  • 27. Mod rewrite installeren 1) sudo a2enmod rewrite 2) sudo pico /etc/apache2/sites- enabled/000-default 3) Change AllowOverride None to AllowOverride All 4) Restart Apache: sudo /etc/init.d/apache2 force-reload Informatics Hans Rossel - www.koba.be
  • 28. Drupal core downloaden Op drupal.org Drupal 6... downloaden (of Drupal 5...) Nederlandse taal downloaden (eerst doen!) Gebundeld www.drupal.be Op alternatieve lokatie (oudere versies) http://ftp.drupal.org/files/projects/ Informatics Hans Rossel - www.koba.be
  • 30. Wampserver Skype uitschakelen Start all services Apache rewrite module aan Localhost testen Bestanden in C:wampwww http://drupal.org/drupal-6.5 En http://drupal.org/project/nl extract in root Unpack (7-zip) Localhost: drupal6-5 Informatics Hans Rossel - www.koba.be
  • 31. Database maken http://localhost/phpmyadmin/ Home > databases > create new database Users > create new user All privileges Informatics Hans Rossel - www.koba.be
  • 32. Installatie # Copy the ./sites/default/default.settings.php file to ./sites/default/settings.php. # Change file permissions so that it is writable by the web server. Informatics Hans Rossel - www.koba.be
  • 33. Installatie zelf Database gegevens invullen Gegevens site invullen Informatics Hans Rossel - www.koba.be
  • 34. Bestandsstructuur Mappen en inhoud Core niet hacken! Sites map instellen: modules/templates Files instellen Informatics Hans Rossel - www.koba.be
  • 35. php.ini Foutreportage & security register_globals = Off Upload en timout limieten memory_limit = 128M upload_max_filesize = 150M post_max_size = 150M max_input_time = 300 max_execution_time = 300 Informatics Hans Rossel - www.koba.be
  • 36. php.ini settings Kunnen ingesteld worden op Een bestandje php.ini uploaden in root In .htaccess php_flag register_globals off php_value memory_limit "128M" php_value max_execution_time 300 In settings.php van Drupal In een gewoon stukje php code: http://www.php.net/ini_set (enkel geldig tijdens script) Let op Syntax verschilt tussen werkwijzen Als .htaccess error 500 geeft staat hosting dit niet toe Informatics Hans Rossel - www.koba.be
  • 37. Installatie op cpanel hosting Drupal 7 uploaden met http://filezilla-project.org/download.php?type=client Een database aanmaken bij databases (niet in phpmyadmin) Eerst database maken Dan user maken Dan user toevoegen aan database, all privileges Drupal installatie Databasenaam en username worden vaak geprefixt met accountname bij hosting: dus accountname_username en accountname_databasename gebruiken Permissies files en settings instellen Informatics Hans Rossel - www.koba.be
  • 39. HOOFDSTUK 3 EEN SIMPELE BROCHURESITE MET ENKEL DRUPAL CORE EEN WYSYWYG EEN PREFAB THEME Informatics Hans Rossel - www.koba.be
  • 40. Basisinstellingen installatie Site instellingen Bestands upload Bestandssysteem Datum en tijd Foutrapportage Site onderhoud Websitegegevens Inhoudelijk beheer Teaserlengte, taxonomie, ... Gebruikers Rollen admin en redactie aanmaken + rechten instellen Gebruikers toevoegen aan een rol Informatics Hans Rossel - www.koba.be
  • 41. Navigatie Blokken: keuze plaats menu Menus Primary & secundary links Settings Items toevoegen Tijdens het invoeren/bewerken van een pagina Via de menu interface Informatics Hans Rossel - www.koba.be
  • 42. Gewone pagina's toevoegen Opbouwen structuur Home: promoted items Over ons Producten Referenties Contact: contact module Informatics Hans Rossel - www.koba.be
  • 43. WYSYWYG De editor www.drupal.org/project/wysiwyg Externe editor downloaden: Ckeditor, Tinymce Alternatief Bueditor, Markdown of Aloha editor (html5) Afbeeldingen in de editor www.drupal.org/project/imce www.drupal.org/project/imce_wysiwyg Informatics Hans Rossel - www.koba.be
  • 44. WYSYWYG installatie & werking Stappen (ook algemeen voor installeren module) Issues bekijken: critical bugs ea bugs + versie kiezen Opladen van de module readme.txt lezen en online handboek Eventuele core patches installeren Dependend modules aanvinken op admin/build/modules Aanvinken op admin/build/modules Toegangsrechten controleren Module settings instellen Kijken als er te activeren blokken zijn bijgekomen Informatics Hans Rossel - www.koba.be
  • 45. Search Zoekfunctie en instellingen Cron laten lopen om index op te vullen Informatics Hans Rossel - www.koba.be
  • 46. POORMANSCRON Noodzaak cron Wissen log bestanden Andere automatische taken Voordelen Simpel te installeren Nadelen Niet regelmatig: start na tijd én nadat user inlogt Niet geschikt voor versturen nieuwsbrieven Alternatief: crontab op server: aan te raden http://drupal.org/cron Kan makkelijk op cpanel hosting Informatics Hans Rossel - www.koba.be
  • 47. HOOFDSTUK THEMES (basis) Informatics Hans Rossel - www.koba.be
  • 48. Bartik en Seven Standard frontend en backend theme Drupal 7 Bartik is bedoeld om uitgebreid te worden via een subtheme (zie theme les) Informatics Hans Rossel - www.koba.be
  • 49. Prefab themes Op Drupal.org http://drupal.org/project/Themes Commercieel http://fusiondrupalthemes.com/ http://www.topnotchthemes.com/portfolio http://www.templatemonster.com/drupal-themes.php Informatics Hans Rossel - www.koba.be
  • 50. MODULES WAAR KEUZE INSTALLATIE Informatics Hans Rossel - www.koba.be
  • 51. Een module kiezen Overzicht: http://drupal.org/project/Modules: thematisch http://drupal.org/project/Modules/name: alfabetisch Related projects & discussions Populariteit http://drupal.org/project/usage: populariteit http://acquia.com/products-services/acquia-drupal-modules: geselecteerd & ondersteund door Acquia Ratings: http://drupalmodules.com Nieuwe modules: http://drupal.org/taxonomy/term/14 Video http://www.lullabot.com/node/439/play Informatics Hans Rossel - www.koba.be
  • 52. Status van een module Versie 6 of 7 Status: Official release Pre-alpha, Alpha, beta, rc (release candidate) Dev versies Opgelet met updates van 7.x-1.x naar 7.x-2.x Informatics Hans Rossel - www.koba.be
  • 53. Factoren kwaliteit module Tijd: maturiteit & actief onderhouden? Eerste versie Laatste update/commit (+ view cvs messages: most active projects) Tijd tussen de updates Futureproof? Drupal 6/7 versie Ontwikkelaar(s) Aantal Hoelang betrokken bij Drupal Andere modules waarvoor verantwoordelijk (cvs messages: most active developers) User profile + track & track code Informatics Hans Rossel - www.koba.be
  • 54. Factoren (vervolg) Issue queue Aantal meldingen (populariteit module) Aantal bugs & opgeloste bugs Aantal patches (betrokkenheid externe developers) Statistieken Omvang module Een klein probleem vraagt een kleine module Geen module als je met enkele lijntjes code kunt oplossen Gevaar voor modulitis: performance site zakt bij elke module die je toevoegt Module usage statistics Concurrerende modules: zie blokken related content Informatics Hans Rossel - www.koba.be
  • 55. Issue queue Vragen over één module steeds hier stellen, niet op forum Statussen, category & priority Advanced search Drupal core issues: http://drupal.org/project/issues/drupal Ingeven van een issue Zoeken naar duplicates Heel duidelijke omschrijving (reproduceerbaar probleem): versies, browser, andere zaken geinstalleerd, stappen hoe je kunt reproduceren op “fresh install”, screenshots, code, views export, cck export Verwijzing naar node via filter Geen titel wijzigen Subscribe? Hopelijk betere oplossing toekomst. Zie ook my issues. Video: http://www.lullabot.com/node/386/play Informatics Hans Rossel - www.koba.be
  • 56. BASIS MODULES TOPMODULES NODIG VOOR bijna ELKE INSTALLATIE Informatics Hans Rossel - www.koba.be
  • 57. CCK EN VIEWS Informatics Hans Rossel - www.koba.be
  • 58. CCK/Fields Historiek en evolutie Nodes → Flexinode → cck contributed (→ fields in core) Doel Eigen content types met eigen velden definiëren Download http://drupal.org/project/cck Extra fields: http://drupal.org/project/Modules/category/88 Informatics Hans Rossel - www.koba.be
  • 59. Basis cck fields Voornaamste extra fields http://drupal.org/project/imagefield http://drupal.org/project/filefield http://drupal.org/project/date http://drupal.org/project/email http://drupal.org/project/link http://drupal.org/project/emfield Informatics Hans Rossel - www.koba.be
  • 60. Afbeeldingen Modules: CCK afbeeldingsveld Imagefield ImageAPI Imagecache Fotoalbum Lightbox2 In combinatie met imagecache (vaste hoogte), views grid view, of css float left Informatics Hans Rossel - www.koba.be
  • 61. Imagecache www.drupal.org/project/imagecache Voordelen Kan via voorgedefinieerde presets images scalen, resizen en croppen Je kunt verschillende varianten van dezelfde foto automatisch laten genereren Informatics Hans Rossel - www.koba.be
  • 62. VIEWS Versies Views 1: Drupal 5: enkel van nodes Views 2: Drupal 6: http://views-help.doc.logrus.com/ Download http://drupal.org/project/views http://drupal.org/project/simpleviews: eenvoudig via views api Doel Lijsten trekken van titels, teksten, foto's, ... Workshop Enkele basisviews aanmaken Informatics Hans Rossel - www.koba.be
  • 63. Informatics Hans Rossel - www.koba.be
  • 65. Relationships http://blip.tv/file/1593750 Informatics Hans Rossel - www.koba.be
  • 66. Theming Basics & Instellingen Informatics Hans Rossel - www.koba.be
  • 67. Theme instellingen Informatics Hans Rossel - www.koba.be
  • 68. Instellingen & Keuze theme Templates: admin/build/themes Core themes en nut Variabelen, logo, snelkoppelingsikoon Berichtinformatie weergeven over Zen ea: extra theme settings Extra variabelen: admin/settings/site-information Eigen template: user/uid/edit (toegangsrechten) Beheertemplate: admin/settings/admin Blokken en menu's Informatics Hans Rossel - www.koba.be
  • 69. Prefab themes installeren Locatie: sites/all/themes Op Drupal.org http://drupal.org/project/Themes Alternatieve weergave http://themegarden.org/drupal6/ http://www.osskins.com/main/category/drupal/ http://www.siteground.com/drupal-hosting/drupal-themes.htm http://themebot.com/website-templates/drupal-themes Ontwerpers http://alldrupalthemes.com/: ADT http://www.roopletheme.com/: roopletheme Informatics Hans Rossel - www.koba.be
  • 71. Betalende Themes Top Notch Themes: goede themes van een bedrijf gegroeid uit de Drupal community, wat een goede integratie garandeert Templatemonster: Drupal themes van een grote template aanbieder http://www.fordrupal.com http://danaythemes.com http://www.drupalshark.com/catalog/themes http://www.themesnap.com/drupal-themes.html Informatics Hans Rossel - www.koba.be
  • 73. CSS Framework Starter Themes css frameworks zijn erg handig om snel complexe layouts te maken die standard compliant zijn. Bekende voorbeelden zijn Blueprint en 960.gs. Bij Drupal vind je de volgende themes die hierop gebaseerd zijn: http://drupal.org/project/blueprint http://drupal.org/project/ninesixty http://drupal.org/project/ninesixtyfluid Informatics Hans Rossel - www.koba.be
  • 74. Admin Themes Nu er erg wordt gewerkt aan het verbeteren van de User Experience en Usability van Drupal zijn er recent heel wat mooie admin themes beschikbaar. Ze zijn bedoeld als theme voor de backend van Drupal en je stelt ze in als beheertemplate. http://drupal.org/project/rootcandy http://drupal.org/project/admin http://drupal.org/project/controlpanel Informatics Hans Rossel - www.koba.be
  • 75. Betalende Theme services Top Notch Themes: goede themes van een bedrijf gegroeid uit de Drupal community, wat een goede integratie garandeert Templatemonster: Drupal themes van een grote template aanbieder http://www.fordrupal.com http://danaythemes.com http://www.drupalshark.com/catalog/themes http://www.themesnap.com/drupal-themes.html Bepaalde bedrijven kunnen ook een psd omzetten naar een Drupal theme: http://vandelaydesign.com/blog/design/psd-to-html-services http://www.psd2html.com/about-us.html (http://drupal.org/node/242847) https://w3-markup.com/order#drupal Software zoals http://www.artisteer.com kan een standaard maar aanpasbaar Drupal theme opzetten. Informatics Hans Rossel - www.koba.be
  • 76. Bestandsstructuur van een theme Informatics Hans Rossel - www.koba.be
  • 77. Basisbestanden: phptemplate .info: definitie van theme screenshot.png Css: Gewoonlijk: style, print, ie6 Template files page.tpl.php, node.tpl.php, block.tpl.php 31 template bestanden in core in D6 (http://drupal.org/node/190815#default-templates) template.php Informatics Hans Rossel - www.koba.be
  • 78. Theme anatomie Informatics Hans Rossel - www.koba.be
  • 79. Customizen theme Template files: 31 in core In theme map In modules map: te overschrijven CSS In theme map: style.css of meer volgens .info In modules map: te overschrijven 30 stylesheets IE: http://drupal.org/project/unlimited_css of http://adaptivethemes.com/load-unlimited-stylesheets-in-ie7 Theme functions In theme map: template.php voor overschrijven theme_ functies en preprocess vars In modules map: in code theme_... (core zie api.drupal.org of http://api.freestylesystems.co.uk voor contrib) Informatics Hans Rossel - www.koba.be
  • 80. .info ; $Id: garland.info,v 1.5 2007/07/01 23:27:32 goba Exp $ name = Garland description = Tableless, recolorable, multi-column, fluid width theme (default). version = VERSION core = 6.x engine = phptemplate stylesheets[all][] = style.css stylesheets[print][] = print.css ; Information added by drupal.org packaging script on 2008-10-08 version = "6.5" project = "drupal" datestamp = "1223497210" Informatics Hans Rossel - www.koba.be
  • 81. page.tpl.php Gebruik van variabelen: <?php if ($left): ?> <?php print $left; ?> <?php endif; ?> <?php if ($is_front): ?> <?php print t('Welkom op de homepage!'); ? > <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 82. Weergave theme functions Voorbeeld: <?php if ($primary_links): ?> <?php print theme('links', $primary_links); ?> <?php endif; ?> Gebruikt http://api.drupal.org/api/function/theme_links/6 Alternatief Menu tree: <?php print theme('menu_tree', menu_tree('primary- links')); ?> Gebruikt: http://api.drupal.org/api/function/theme_menu_tree/6 Informatics Hans Rossel - www.koba.be
  • 83. Een nieuw theme ontwikkelen Informatics Hans Rossel - www.koba.be
  • 84. Vertrekpunten Starten vanaf een bestaande statische html prototype/wireframe (from scratch of http://www.oswd.org) Starten vanaf Zen theme: hacken via subtheme Starten vanaf een bestaand (of eigen basistheme) Drupal theme: hacken of subtheme Informatics Hans Rossel - www.koba.be
  • 85. Een nieuw theme ontwerpen METHODE 1: Starten vanaf een statische prototype Informatics Hans Rossel - www.koba.be
  • 86. Wireframe Informatics Hans Rossel - www.koba.be
  • 88. Statische prototype Een gewone html pagina of versie van de hoofdpagina's van je site Html en css voor Drupal Gebruik geen .content, .links, .menu, .header, .picture: worden reeds gebruikt door Drupal & geeft conflicten Bedenken wat regions en wat blokken zullen zijn Rekening houden met .item-list en andere door core gegenereerde html en styles Gebruik – ipv _ in class en id namen Informatics Hans Rossel - www.koba.be
  • 89. Belangrijke css aspecten Box model Display:inline; en display:block; Wat standaard & Verschil margins. Problemen met float drupping bij IE padding: dus .inner of margin Floats Float design: alles floaten en tussendoor clearen Verschil display:inline; en float:left; voor lists Floated image eerst en blok die het omvat moet ook gefloat zijn Lijsten: Koppig wegens inheritance, geen !important Drupal .item-list class overriden Conditional comments ipv hacks Informatics Hans Rossel - www.koba.be
  • 90. Opgelet: Caching Na elke wijziging in template, cache wissen. 6 Manieren: Klik op de "cache data opschonen" knop op Beheren > Site-instellingen > Prestatie. Klik in Devel block op de "Empty cache" link. Bezoek de Beheren > Site-constructie > Templates pagina (werkt niet altijd) Views theme information template.php: drupal_rebuild_theme_registry(); Zen theme settings Informatics Hans Rossel - www.koba.be
  • 91. STAP 1: Theme folder Maak een mapje in sites/all/themes met de naam van je theme vb abc Stel admin theme in op Garland Informatics Hans Rossel - www.koba.be
  • 92. STAP 2: .info file: basis .info handbook: http://drupal.org/node/171205 Maak abc.info file met inhoud ; $Id$ name = abc description = ABC theme version = 1.0 core = 6.x engine = phptemplate Informatics Hans Rossel - www.koba.be
  • 93. .info file: regions Standaard: regions[left] = Left sidebar regions[right] = Right sidebar regions[content] = Content regions[header] = Header regions[footer] = Footer Informatics Hans Rossel - www.koba.be
  • 94. .info file: eigen regions regions[left] = Left sidebar regions[right] = Right sidebar regions[header] = Header regions[footer] = Footer regions[content_top] = Content top regions[content_bottom] = Content bottom regions[navbar] = Navbar regions[helemaalrechtsboven] = Helemaal rechts boven Opm: Bestaande naamgeving best behouden, maar eigen nieuwe toevoegen Informatics Hans Rossel - www.koba.be
  • 95. STAP 3: css In .info file: stylesheets[all][] = style.css stylesheets[print][] = print.css Oude methode (d5): in template.php via vb: drupal_add_css(drupal_get_path('theme', 'abc') . '/mystyle.css', 'theme'); In page.tpl.php: <?php print $styles; ?> Informatics Hans Rossel - www.koba.be
  • 96. STAP 4: page.tpl.php Sla je statische pagina op onder de naam page.tpl.php. Dynamisch maken: $title, $content en $tabs invoegen. Constructie invoegen variabelen (Theme coding conventions: http://drupal.org/node/1965) <?php if ($tabs): ?> <div class="tabs"> <?php print $tabs; ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 97. Regions (blokken) invoegen Zoals gedefinieerd in .info file: $header, $left, $right, $footer, $content_top, $content_bottom, $navbar <?php if ($content_top): ?> <div id="content-top" class="region"> <?php print $content_top; ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 98. Navigatie invoegen <?php if ($primary_links): ?> <div id="primary"> <?php print theme('links', $primary_links); ?> </div> <?php endif; ?> <?php if ($secondary_links): ?> <div id="secondary"> <?php print theme('links', $secondary_links); ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 99. Logo <?php if ($logo): ?> <div id="logo"> <a href="<?php print $base_path; ?>" title="<?php print t('Home'); ?>"> <img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" title="<?php print t('Home'); ?>" /> </a> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 100. Breadcrumbs <?php if ($breadcrumb): ?> <div class="breadcrumb"> <?php print $breadcrumb ?> &raquo; <?php print $title; ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 101. Zoekbox <?php if ($search_box): ?> <div class="search-box"> <?php print $search_box ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 102. Drupal zaken <?php if ($help): print $help; endif; ?> $help: Dynamische help tekst van admin pagina's <?php if ($messages): print $messages; endif; ?> $messages: html voor status, fouten en waarschuwingen, fouten hierin uit te schakelen via foutrapportage Screenshot.png http://drupal.org/node/11637 Informatics Hans Rossel - www.koba.be
  • 103. Doctype & Head <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict// EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<? php print $language->language; ?>" lang="<?php print $language->language; ?>" dir="<?php print $language- >dir; ?>"> <title><?php print $head_title; ?></title> <?php print $head; ?> Informatics Hans Rossel - www.koba.be
  • 104. Footer $feed_icons: RSS feed ikoontjes voor de huidige pagina $footer_message: Voetbericht zoals ingesteld bij websitegegevens $footer : De voet region zoals gedefinieerd in template.php. $closure: Eind html van modules die de pagina gewijzigd hebben. Moet altijd na op het einde komen na alle andere dynamische content. Problemen met javascript als deze variabele vergeten wordt. Informatics Hans Rossel - www.koba.be
  • 105. page.tpl.php: identiteit $front_page: url van de homepage, inclusief de taalprefix of taaldomein $logo: Pad naar logo image, zoals opgeladen in admin/ build/themes/settings $site_name: Naam van de site, zoals ingesteld in websitegegevens $site_slogan: Slogan van de site, zoals ingesteld in websitegegevens $mission: Missie van de site, zoals ingesteld in websitegegevens Informatics Hans Rossel - www.koba.be
  • 106. STAP 4: Javascript In .info file: scripts[] = myscript.js Oude methode (d5): in template.php via vb: drupal_add_js(drupal_get_path('theme', 'abc') . '/myscripts.js', 'theme') In page.tpl.php: <?php print $scripts; ?> Informatics Hans Rossel - www.koba.be
  • 107. Een nieuw theme ontwerpen METHODE 2: Een subtheme van het Zen theme Informatics Hans Rossel - www.koba.be
  • 108. ZEN Theme www.drupal.org/project/zen Net als Garland gebaseerd op de http://www.positioniseverything.net/articles/jello.h Jello Mold techniek Voordelen Enorm goede documentatie in comments Extra functies (theme settings, block editing) Perfect full option hackable via subtheme Informatics Hans Rossel - www.koba.be
  • 109. Een Zen subtheme - #226507 Kopieer STARTERKIT en hernoem het .info: mijntheme.info + verwijzingen CSS layout-liquid.css of layout-fixed.css → layout.css zen.css → mijntheme.css Optie: html-elements.css + ;weghalen uit .info file Kopieer tpl.php files indien gewenst Informatics Hans Rossel - www.koba.be
  • 110. Een nieuw theme ontwerpen METHODE 3: Hacken via subtheme van bestaand theme Informatics Hans Rossel - www.koba.be
  • 111. Een subtheme maken Maak een map met naam van de theme morelli.info (#171205) name = Morelli Description = Mooi theme Version = 1.0 Core = 6.x Base theme = garland stylesheets[all][] = morelli.css Informatics Hans Rossel - www.koba.be
  • 112. DYNAMISCH THEMEN Theme wijzigen volgens voorwaarden Informatics Hans Rossel - www.koba.be
  • 113. Dynamisch sturen Diverse mogelijkheden Via css: oa $body_classes Via block visibility settings Via dynamische variabelen Via meerdere templates: volgens url, user, content type Intercept & override variables Informatics Hans Rossel - www.koba.be
  • 114. Drupal paden, classes voor css Standaard: node/nid Opvragen via: http://api.drupal.org/api/function/arg/6 Voorbeeld Drupal path: node/11 <?php print arg(0); ?> geeft node <?php print arg(1); ?> geeft 11 <?php if (arg(2) == 'edit') { echo $content; } Informatics Hans Rossel - www.koba.be
  • 115. URL Aliassen opvragen Zie: http://api.drupal.org/api/function/drupal_get_path_alias/6 en http://www.php.net/manual/en/reserved.variables.get.php <?php // $_GET['q'] geeft node/nid en explode() splitst de string op bij '/' en plaatst de stukken in een array $path_pieces = explode('/', drupal_get_path_alias($_GET['q'])); // dus als het pad is /abc/def, $path_pieces is dan Array ( [0] => abc, [1] => def ) // Dus, $path_pieces[0] geeft 'abc' print $path_pieces[0]; ?> vb andere headers volgens content indien pathauto blogs of block visibility settings <body class="<?php print $body_classes . ' ' . $path_pieces[0]; ?>"> body.node-type-blog #header, body.page-nl-blogger-list #header, body.blogs #header, body.blog #header { background-image:url(images/blogheader.jpg); } Informatics Hans Rossel - www.koba.be
  • 116. PATHAUTO Download: http://drupal.org/project/pathauto Doel: Automatische urls Hackable urls: http://drupal.org/node/247205 Sturen: vb op basis van url themen Afstellen i18n-ascii.txt bestand (niet vergeten bij update) Bulk delete en bulk generate aliassen Informatics Hans Rossel - www.koba.be
  • 117. Spelen met blokken Volgens url www.drupal.org/project/pathauto Zichtbaarheid voor blog/*, videos/*, nieuws/* Volgens rol Admin blokken: redactie, who's online, statistieken Php zichtbaarheid Enkel voor bepaalde ct's Informatics Hans Rossel - www.koba.be
  • 118. Block visibility settings: $match = FALSE; php $types = array('onderwijsmap' => 1, 'campagne' => 2); //Inhoudstypes waarvoor we het blok willen tonen if (arg(0) == 'node' && is_numeric(arg(1))) { $nid = arg(1); $node = node_load(array('nid' => $nid)); $type = $node->type; if (isset($types[$type])) { $match = TRUE; } } $url = request_uri(); if (strpos($url, "wat-we-doen")) { //url waarvoor we het blok willen tonen, dus wat-we-doen/* $match = TRUE; } return $match; Meer: http://drupal.org/node/134425 Informatics Hans Rossel - www.koba.be
  • 119. Extra page.tpl.php files Vorm: page-url-stukjes.tpl.php Handig, lijkt goed op html templating, maar vermijden indien mogelijk Onderhoudbaarheid: header en footergedeelte via includes Informatics Hans Rossel - www.koba.be
  • 120. Meerdere page.tpl.php files Frontpage page-front.tpl.php Voor node pad (url) Page-node-edit.tpl.php of page-node-add.tpl.php > page-node-1.tpl.php > page-node.tpl.php > page.tpl.php Volgens users page-user-1.tpl.php Volgens url (view of module) page-blog-tpl.php, page-viewpagename.tpl.php, page-node-add.tpl.php, page-admin.tpl.php, page-admin-build-block.tpl.php, page-civicrm.tpl.php, page-googlemap.tpl.php, ... Let op: volgens url niet voor node aliassen, steeds Drupal path vb node/ 2 Informatics Hans Rossel - www.koba.be
  • 121. Page.tpl.php extra Via preprocess functie in template.php kan ondersteuning toegevoegd worden voor page.tpl.php bestanden voor aliassen en voor taxonomy Informatics Hans Rossel - www.koba.be
  • 122. Dynamische variabelen Deze variabelen zijn beschikbaar voor alle template files, zie theme.inc $id: positie van de template. Telkens de template is gebruikt, wordt dit cijfer verhoogd met 1. Gedefinieerd als $variables['id'] = $count[$hook]++; $zebra: odd of even, wisselt telkens de template wordt gebruikt. Gedefinieerd als $variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even'; $directory: het pad van de theme tov de base van de installatie: vb "sites/all/themes/myTheme". Gedefinieerd als $variables['directory'] = path_to_theme(); $is_admin: TRUE als de bezoeker een site administrator is. Gedefinieerd als $variables['is_admin'] = user_access('access administration pages'); $is_front: TRUE als de frontpage van de site wordt bekeken. Gebruiken als alternatief voor page-front.tpl.php. De homepage is standaard /node (=promoted to frontpage teasers) of zoals ingesteld op admin/settings/site-information. Gedefinieerd als $variables['is_front'] = drupal_is_front_page(); $logged_in: TRUE als de bezoeker ingelogd is. Gedefinieerd als $variables['logged_in'] = ($user->uid > 0);) $user: Het volledige user object met de data van de huidige bezoeker. Sommige data kan onveilig zijn, dus moet in check_plain verpakt worden (of t functie) vooraleer weergegeven. $base_path: Basis url van de Drupal installatie, meestal / Informatics Hans Rossel - www.koba.be
  • 123. Variabelen opvragen In een template file <?php print_r(get_defined_vars()); ?> Via Devel module: excecute php block dsm($node); Informatics Hans Rossel - www.koba.be
  • 124. Node en User Object Node object User object <?php print_r($node); ?> <?php print_r($user); ?> <?php <?php var_export($node); ?> var_export($user); ?> <?php <?php var_dump($user); ? var_dump($node); ?> > Veiligheid: Veiligheid check_url($front_page); check_url($user → ...); check_plain($node->body); check_plain($user → name); check_markup($node->body); Informatics Hans Rossel - www.koba.be
  • 125. Theme Security Gevaren: xss, … Functies ter beveiliging Informatics Hans Rossel - www.koba.be
  • 126. Toegangsrechten global $user; if (!user_access('toegang tot mijn code')) {print "Geen toegang tot mijn code"; } if (in_array('hoofdredactie',$user->roles) || ($user->uid == 1)) {print “Code die alleen mensen met rol hoofdredactie of user nr 1 zien”; } <!-- <?php print_r($node); ?> --> Informatics Hans Rossel - www.koba.be
  • 127. User zaken <?php global $user; $uid = $user->uid; if (!in_array("lid", $user->roles)){ print '<a href="/word-lid">Word lid </a>'; } if ($uid) { Print 'Welkom, je bent nu ingelogd als '; print $user->name; print '<a href="/logout"> Uitloggen</a>'; } ?> Informatics Hans Rossel - www.koba.be
  • 128. Node object laden Voor execute php in devel <?php if (arg(0) == 'node' && is_numeric(arg(1))) { $node = node_load(arg(1)); print_r($node); } ?> Informatics Hans Rossel - www.koba.be
  • 129. Node controleren function phptemplate_preprocess(&$variables, $hook) { global $theme; $variables['ifnode'] = ( (arg(0) == 'node') && is_numeric(arg(1)) ) && (arg(2) != 'edit' || arg(2) != 'delete'); } Informatics Hans Rossel - www.koba.be
  • 130. $user_agent = $_SERVER['HTTP_USER_AGENT']; if($user_agent) { Browser controleren if (strpos($user_agent, 'MSIE')) { $body_classes[] = 'browser-ie'; } else if (strpos($user_agent, 'MSIE 6.0')) { $body_classes[] = 'browser-ie6'; } else if (strpos($user_agent, 'MSIE 7.0')) { $body_classes[] = 'browser-ie7'; } else if (strpos($user_agent, 'MSIE 8.0')) { $body_classes[] = 'browser-ie8'; } else if (strpos($user_agent, 'Firefox/2')) { $body_classes[] = 'browser-firefox2'; } else if (strpos($user_agent, 'Firefox/3')) { $body_classes[] = 'browser-firefox3'; }else if (strpos($user_agent, 'Safari')) { $body_classes[] = 'browser-safari'; } else if (strpos($user_agent, 'Opera')) { $body_classes[] = 'browser-opera'; } } $vars['body_classes'] = implode(' ', $body_classes); // Concatenate with spaces } Informatics Hans Rossel - www.koba.be
  • 131. Submitted Standaard: <?php if ($submitted): ?> <?php print $submitted; ?> <?php endif; ?> Beter <?php if ($submitted): ?> <div class="submitted"> <?php print t('Door ') . theme('username', $node) . t(' - Ingediend op ') . format_date($node->created, 'custom', "F jS, Y"); ?> </div> <?php endif; ?> Informatics Hans Rossel - www.koba.be
  • 132. Preprocess functies Opvolger van function phptemplate_preprocess_page(&$vars) { _phptemplate_variables() in Drupal $vars['tabs2'] = menu_secondary_local_tasks(); 5 Zie ook: Preprocess functions // Hook into color.module http://drupal.org/node/223430 http://api.drupal.org/api/function/template_preprocess/6 if (module_exists('color')) { _color_page_alter($vars); } } Informatics Hans Rossel - www.koba.be
  • 133. Taxonomy theming The value of $terms is generated in the theme layer so it's http://api.drupal.org/api/function/template_preprocess_node/6 First, a $taxonomy variable is created with: $variables['taxonomy'] = taxonomy_link('taxonomy terms', $node); The value of $terms is created with: $variables['terms'] = theme('links', $variables['taxonomy'], array('class' => 'links inline')); Check out the theme_links doc (http://api.drupal.org/api/function/theme_links/6). If you can't add your CSS the way you want to using the $attributes parameter, you'll need to create a custom function. Informatics Hans Rossel - www.koba.be
  • 134. ANDERE TEMPLATE BESTANDEN Informatics Hans Rossel - www.koba.be
  • 135. node.tpl.php: algemeen $title: de titel van de pagina $content: Node body of teaser afhankelijk van de $teaser vlag. $picture: foto van de auteur, zoals ingesteld in mijn account na toelating op admin/user/settings, opgemaakt volgens theme_user_picture(). $date: Themed datum van aanmaak (gebruik $created om te herformatteren met format_date()). $links: Themed Links al "Lees meer", "Reactie toevoegen", ... opgemaakt volgens theme_links(). $name: Themed gebruikersnaam van auteur van theme_user(). $node_url: directe url van de huidige node. $terms: Themed links van taxonomie termen opgemaakt volgens theme_links(). $submitted: Themed indieninformatie opgemaakt volgens theme_node_submitted(). Informatics Hans Rossel - www.koba.be
  • 136. node.tpl.php: andere $node: Volledige node object, kan data bevatten die niet veilig is. Zie http://drupal.org/node/28984 $type: Node type, i.e. story, page, blog, etc. $comment_count: Aantal comments bij deze node $uid: User ID van de auteur van de node. $created: Unix tijdsstamp van het tijdstip waarop de node was gepubliceerd. $zebra: Geeft "even" of "odd". Voor zebra striping in teaser listings. $id: Positie van de node, neemt toe met 1 telkens een node wordt weergegeven, vb om op de homepage lijst van promoted to frontpage content het eerste item $id=1 anders te themen. Informatics Hans Rossel - www.koba.be
  • 137. node.tpl.php: status $teaser: Vlag voor teaser status. $page: Vlag voor full node status. $promote: Vlag voor 'aangeraden op de voorpagina' status $sticky: Vlag voor vastgeplakt bovenaan de lijst status $status: Vlag voor publicatie status $comment: Vlag voor comment setting van de node $readmore: Vlag geeft true als de volledige hoofdcontent van de pagina is groter dan het ingekorte teaser gedeelte. $is_front: Vlag geeft true als in frontpage. $logged_in: Vlag geeft true als de huidige gebruiker is ingelogds $is_admin: Vlag geeft true als de huidige gebruiker een administrator is. Informatics Hans Rossel - www.koba.be
  • 138. Blocks in node.tpl.php Blokken worden normaal geprint in page.tpl.php. Soms liever printen in node.tpl.php vb: Bij het weergeven van $content_bottom views staan links fout Informatics Hans Rossel - www.koba.be
  • 139. Blocks in subthemes function phptemplate_preprocess(&$variables, $hook) { $variables['node_region'] = theme('blocks', 'node_region'); } Voor subthemes (oa Zen) function subtheme_preprocess_node(&$variables) { $variables['node_region'] = theme('blocks', 'node_region'); } Informatics Hans Rossel - www.koba.be
  • 140. Meerdere node.tpl.php Volgens content type node-blog.tpl.php node-forum.tpl.php node-page.tpl.php node-ccknieuwsbericht.tpl.php Informatics Hans Rossel - www.koba.be
  • 141. Block.tpl.php Opsplitsen in meerdere Moduleblok: block-modulename-delta.tpl.php > block-modulename.tpl.php > block-region.tpl.php > block.tpl.php Eigen blok: block-block-bloknummer.tpl.php Voorbeeld block-user-2.tpl.php block-user.tpl.php block-left.tpl.php Informatics Hans Rossel - www.koba.be
  • 142. Nieuwe tpl.php bestanden Naast comment en box sinds Drupal 6: in mapje van core en andere modules Override = Kopiëren naar theme map + aanpassen Via Theme Developer (Devel) Informatics Hans Rossel - www.koba.be
  • 143. THEME FUNCTIES Informatics Hans Rossel - www.koba.be
  • 144. Theme overrides Informatics Hans Rossel - www.koba.be
  • 145. Intercept & override Basisprincipe: core niet hacken Niet akkoord met de html en css? Css: css door core gedefinieerd overriden in style.css of andere .css bestanden (via .info). http://www.drupalcoder.com/story/495- overriding-css-stylesheets-in-drupal-themes Html: Template files: zie eerder theme overrides: html die wordt gegenereerd door de modules theme_... functies Informatics Hans Rossel - www.koba.be
  • 146. Theme functies zoeken Lijst: http://api.drupal.org/api/group/themeable/6 Themable functies vinden theme_ Zoeken api.drupal.org (core) of http://api.freestylesystems.co.uk/api/6 (contibuted) of eigen via http://drupal.org/project/api In een .module file: zoeken naar theme_... Informatics Hans Rossel - www.koba.be
  • 147. Theme functies overriden Overriden in template.php Phptemplate_...: voor alle themes Mytheme_...: voor mytheme (veiliger) Informatics Hans Rossel - www.koba.be
  • 148. IMAGE CACHE THEMING Informatics Hans Rossel - www.koba.be
  • 149. On the fly creation: Image cache /PATH/TO/files/imagecache/YOUR_PRESET_NAME/YOUR_FILE_PATH <?php print '<img src=”' . check_url('/sites/default/files/imagecache/YOUR_PRESET_NAME/files/YOUR_FILE_PATH') . '“>'; ?> Voorbeeld sites/default/files/imagecache/PaginaVasteBreedte/afbeeldingen/fotos/sized_Tajine_0.JPG http://www.example.com/sites/default/files/imagecache/width200/fotos/zonsondergang.jpg $output .= '<img src="/'; $output .= 'files/imagecache/bloggers70x70/'; $output .= $user_info->picture; $output .= '" />'; Informatics Hans Rossel - www.koba.be
  • 150. Theming Image Cache <?php print_r($field_fotoveldnaam); ?> $foto = theme('imagecache','resize310208', $node->field_fotoveldnaam[0]['filepath']); print $foto; of print '<img src=”' . $base_path . 'sites/default/files/imagecache/resize310208/files/fotomap/ '. $node->field_fotoveldnaam[0]['filename'] . '” id=”gallery_big” alt=”' . $title . '” title=”' . $title . '” />”'; Informatics Hans Rossel - www.koba.be
  • 151. LOGIN FORM THEMING Informatics Hans Rossel - www.koba.be
  • 152. Login form theming Zie http://thefaultandfracture.blogspot.com/2009/04/theming-drupal-user-login-form.html Informatics Hans Rossel - www.koba.be
  • 153. Css wisselen function [themename]_preprocess_node(&$vars, $hook) { if ($vars['type'] == 'adcoupon') { // Node type is 'adcoupon' drupal_add_css(drupal_get_path('theme','[themename]').'/adcoupon.css','them e'); } In this case the node type (adcoupon) is actually a cck type. I have the specific css file in the theme directory. Informatics Hans Rossel - www.koba.be
  • 154. BASIS THEME FUNCTIES Informatics Hans Rossel - www.koba.be
  • 155. Theme developer Informatics Hans Rossel - www.koba.be
  • 156. Themeable functions http://api.drupal.org/api/group/themeable/6 Informatics Hans Rossel - www.koba.be
  • 157. L functie: een link maken http://api.drupal.org/api/function/l/6 Vorm: l($text, $path, $options = array()); Eenvoudig voorbeeld l(t('klik hier'), “node/1”); Voorbeeld uit blog module l(t('View recent blog entries'), "blog/$user->uid", array('attributes' => array('title' => t("Read @username's latest blog entries.", array('@username' => $user- >name))))); Informatics Hans Rossel - www.koba.be
  • 158. theme_item_list: een lijst http://api.drupal.org/api/function/theme_item_list/6 Vorm: theme_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL) Voorbeeld <?php $items = array('jan','piet','joris'); print theme('item_list', $items, NULL, 'ul', array('class' => 'mijn- lijst', 'id' => 'de-lijst')) ?> Informatics Hans Rossel - www.koba.be
  • 159. theme_table http://api.drupal.org/api/function/theme_table/6 Vorm: theme_table($header, $rows, $attributes = array(), $caption = NULL) Voorbeelden: zie http://drupal.org/node/156863 Informatics Hans Rossel - www.koba.be
  • 160. theme_links http://api.drupal.org/api/function/theme_links/6 Vorm: theme_links($links, $attributes = array('class' => 'links')) Voorbeeld theme('links', $primary_links, array('class' => 'links primary- links', 'id' => 'primary')) Informatics Hans Rossel - www.koba.be
  • 161. HOMEPAGE Informatics Hans Rossel - www.koba.be
  • 162. Homepage theming (via wysiwyg) Standaard Drupal met blokken en extra regions Als eigen content type Als page-front.tpl.php Via Panels Informatics Hans Rossel - www.koba.be
  • 163. Permissies If ($logged_in) {…} If (!$logged_in) {…} If ($is_admin) {…} If (in_array('redactie'), array_values($user- >roles)) {...} Informatics Hans Rossel - www.koba.be
  • 164. THEME SWITCHING (ADVANCED) Informatics Hans Rossel - www.koba.be
  • 165. <?php Wisselen van theme /** * Implementation of hook_menu (D5 code) */ function SOMEMODULE_menu($may_cache) { if (!$may_cache) { if ($theme = $_GET['theme']) { $themes = list_themes(); if (isset($themes[$theme])) { $GLOBALS['custom_theme'] = $theme; } } } } ?> With this you can amuse yourself by browsing to /node/1?theme=marvin I was thinking this could actually be useful- for example you could make an all xml theme and have Flash get data from path/to/page?theme=xml_theme Informatics Hans Rossel - www.koba.be
  • 166. Theme op basis van url In settings.php // if the url is an administration page if (strpos($_GET['q'], 'admin') === 0) { $conf['theme_default'] = 'garland'; } <?php $args = explode('/', $_GET['q']); if ($args[0] == 'admin') { $GLOBALS['custom_theme'] = 'mytheme/admin'; } ?> Informatics Hans Rossel - www.koba.be
  • 167. Nog code Zie http://drupal.org/node/26357 $parts = explode('.', $_SERVER['HTTP_HOST']); if ($parts[0] == 'mobile') { $GLOBALS['custom_theme'] = 'mobile'; } Informatics Hans Rossel - www.koba.be
  • 169. BACKUPS, ONDERHOUD & UPGRADES Informatics Hans Rossel - www.koba.be
  • 170. Databasestructuur Via phpmyadmin Cache Nodes Terms Users Informatics Hans Rossel - www.koba.be
  • 171. Nuttige acties Paswoord en email wijzigen van user 1 Een slechte module uitschakelen Een blok met foute php code uitschakelen Cache tabellen leegmaken Access log leegmaken Optimize tables Informatics Hans Rossel - www.koba.be
  • 172. BACKUP DATABASE Informatics Hans Rossel - www.koba.be
  • 173. BACKUP FILES Vooral de map sites is van belang, met de map files in het bijzonder Ftp 2000 files max Informatics Hans Rossel - www.koba.be
  • 174. Backup modules & info Handbook: http://drupal.org/node/22281 http://drupal.org/project/backup_migrate Beste en actiefste backup module op dit ogenblik Scheduled backup Excluden van grote tabellen: search, cache, sessions http://www.ozerov.de/bigdump.php: grote databases Informatics Hans Rossel - www.koba.be
  • 175. Upgraden: puntupgrade Stap 1: Backup sites & database Stap 2: Inloggen als user 1 + Offline mode Stap 3: Alle bestanden verwijderen, behalve sites. Stap 4: Nieuwe bestanden in de plaats zetten Stap 5: Patches herinstalleren Stap 6: update.php laten lopen Stap 7: patches herinstalleren Stap 8: controle installatie en logs Informatics Hans Rossel - www.koba.be
  • 176. Diff & Patch www.drupal.org/patch Cygwin Linux omgeving in Windows http://www.cygwin.com Nut bij Drupal: diff, patch en cvs Screencast: http://www.lullabot.com/node/280/play Patching Screencast: http://e4.video.blip.tv/1540000325302/Add1sun- RollingPatchesInDrupal517.mov Informatics Hans Rossel - www.koba.be
  • 177. Automatische updates http://groups.drupal.org/aegir-hosting-system Hosting systeem voor meerdere Drupal sites Bevat Drush en Dashboard http://drupal.org/project/plugin_manager Zit bij Drupal 7 in core Informatics Hans Rossel - www.koba.be
  • 178. Drush: Drupal Shell http://drupal.org/project/drush (ook voor windows) http://vimeo.com/5207683 Extra http://drupal.org/taxonomy/term/4654 http://www.archive.org/details/DrupalconSf2010Drush http://www.archive.org/details/DrupalconSf2010AdvancedDrush Informatics Hans Rossel - www.koba.be
  • 179. Drush commando voorbeelden Drupal installeren in htdocs of www mapje drush (help uitleg) drush dl drupal (download drupal) drush dl cck views nl ckeditor acquia_marina backup_migrate (in drupal map) drush en cck views (modules aanleggen, omgekeerd: dis) drush cron Drupal updaten met drush drush bam backup of drush sql-dump > example10052010.sql tar -czf drupal.tgz drupal drush variable-set site_offline TRUE drush up: update alle modules + backup code drush updb: run update.php drush variable-set site_offline FALSE Informatics Hans Rossel - www.koba.be
  • 180. Drush make Drush make: bundelen van de automatisaties Installeren: drush dl drush_make Makefile opstellen: Drush generate makefile /opt/lampp/htdocs/makefiles/example.make Drush convert makefile example.make example.make drush make example.make example (maakt een drupal site op /example) Informatics Hans Rossel - www.koba.be
  • 181. Drush make structuur core = 6.x projects[] = drupal projects[] = cck projects[] = views Uitgebreid voorbeeld: http://drupalcode.org/viewvc/drupal/contributions/profiles/openatrium/openatrium.make?revision=1 Informatics Hans Rossel - www.koba.be
  • 182. TAXONOMY Informatics Hans Rossel - www.koba.be
  • 183. Taxonomy Indelen in woordenschatten (taxonomies, trefwoordgroepen) Termen (trefwoorden) Beheren > Taxonomy Extra modules Taxonomy manager Taxonomy_csv: importeren van trefwoordlijsten http://drupal.org/project/modules? Informatics Hans Rossel - www.koba.be
  • 184. Taxonomy Indeling in categorieën Hierarchie Free tagging of controlled Urls of views arguments Content taxonomy module Hierachical select module Informatics Hans Rossel - www.koba.be
  • 185. Taxonomy Indeling in categorieën Hierarchie Free tagging of controlled Urls of views arguments Content taxonomy module Hierachical select module Informatics Hans Rossel - www.koba.be
  • 186. Taxonomy Indeling in categorieën Hierarchie Free tagging of controlled Urls of views arguments Content taxonomy module Hierachical select module Informatics Hans Rossel - www.koba.be
  • 187. MEERTALIGE WEBSITES Informatics Hans Rossel - www.koba.be
  • 188. Multilingual Drupal Veraalbare delen i18n: internationalisation: content L10n: localisation: interface Multilingual settings Drupal core: basis functionaliteiten Drupal contrib: i18n module: vertalen van menu's, blocks, taxonomy, … Handbook: http://drupal.org/node/324602 Informatics Hans Rossel - www.koba.be
  • 189. Vertalen core & modules http://drupal.org/project/Translations http://drupal.org/project/nl http://drupal.org/project/fr Uitpakken in root Aanleggen modules Locale: interface translation Content translation: content translation Informatics Hans Rossel - www.koba.be
  • 190. Toevoegen talen Best bij eerste installatie Unpack language files in root: translation maps with .po files are created /admin/settings/language Toevoegen nieuwe taal Import translation: 1 or more .po files /admin/settings/language/configure: path prefix with language fallback /nl/admin/settings/language/edit/nl: edit language: choose prefix Informatics Hans Rossel - www.koba.be
  • 191. Interface vertalen /admin/build/translate/search: Zoeken naar vertaalbare strings in modules, themes, drupal core vertaalbaar=verpakt in t('test'); function http://drupal.org/project/l10n_client: makkelijker interface voor vlotte vertaling Import: /admin/build/translate/import Volledig of aparte po bestanden downloaden van drupal.org Informatics Hans Rossel - www.koba.be
  • 192. Modules Contributed http://drupal.org/project/l10n_client: makkelijker interface vertaling http://drupal.org/project/i18n: meer opties voor content vertaling Translation server: http://localize.drupal.org Export: http://localize.drupal.org/translate/languages/nl/export?project=drupal All in one file: po file Je eigen translation server: http://drupal.org/project/l10n_server Informatics Hans Rossel - www.koba.be
  • 193. Evenementen Informatics Hans Rossel - www.koba.be
  • 194. Date views www.drupal.org/project/date: Datum veld toevoegen Inhoudstype afwerken voor evenement View Filter opties: Selecteer events > now www.drupal.org/project/calendar Display of calendar block Advanced views: argument op juiste datumveld zetten Informatics Hans Rossel - www.koba.be
  • 195. Fotogallerij met views Inhoudstype Titel en 1 foto veld Comments aan View maken van alle foto's http://drupal.org/project/custom_pagers: volgende vorige links Informatics Hans Rossel - www.koba.be
  • 196. Features www.drupal.org/project/features Verpakken van settings als herbruikbare module Feature servers http://www.lullabot.com/articles/photo-galleries-v Downloaden en in sites/all/modules Views Gallery Module activeren Nodige dependent modules activeren Informatics Hans Rossel - www.koba.be
  • 197. WEBFORM Informatics Hans Rossel - www.koba.be
  • 198. Webform www.drupal.org/project/webform Uitgebreide contact, bestel, inschrijving, enquete formulieren Diverse elementen: multistep form, grid, email Export naar Excel en statistieken Geen views integratie (wel in dev of via extra module tijdelijk) Minder integratie dan cck Informatics Hans Rossel - www.koba.be
  • 199. MULTISITE INSTALLATION Informatics Hans Rossel - www.koba.be
  • 200. Multisite Setup: Zelfde codebase (Drupal download) voor meerdere websites 1 aparte database (settings.php) per site (aanbevolen) Voordelen Onderhoud/updating van code is makkelijker (maar 1 codebasis updaten) Nadeel Alle sites moeten op dezelfde snelheid upgedated worden (je kunt uitzonderingen maken, maar verliest dan een beetje het voordeel van de multisite) => Werkt best met gelijkaardige sites Handbook Commentaar in settings.php http://drupal.org/getting-started/6/install/multi-site Informatics Hans Rossel - www.koba.be
  • 201. Code structure Voor een fictieve site op http://www.example.be/mysite/test/, de 'settings.php' wordt gezocht in de volgende mappen: sites/www.example.be.mysite.test sites/example.be.mysite.test sites/be.mysite.test sites/www.example.be.mysite sites/example.be.mysite sites/be.mysite sites/www.example.be sites/example.be sites/be sites/default Informatics Hans Rossel - www.koba.be
  • 202. Code structure sites/all: /modules and /themes for all sites sites/default: settings.php hier is default voor alle sites, niet nodig sites/site1.be sites/site1.be/modules: enkele modules die alleen maar gebruikt worden op site 1 sites/site1.be/themes: een of meer themes alleen maar gebruikt op site 1 sites/site1.be/files: bestanden in te stellen bij admin/settings/ file-system (sites kunnen files sharen; goed nadenken over filestructure/permissions op voorhand als je wil sharen) sites/site1.be/settings.php: database details voor site1. Fresh copy of default.settings.php: ga naar elke site om de installer te lanceren en I settings.php in te stellen.- www.koba.be nformatics Hans Rossel
  • 203. Setup on server Cpanel Maak “parked domain” site1.be (check domain root = /public_html) Maak symlink van site1 naar root indien niet zo of bij addon domein Dedicated server Setup virtual hosts Maak symlink Informatics Hans Rossel - www.koba.be
  • 204. Create Virtual Hosts Belangrijk elk domein moet naar zelfde set Drupal files richten Setup dns entries for site1.be and site2.be /etc/apache2/sites-available/ or httpd.conf Listen 80 <VirtualHost *:80> DocumentRoot /absolute/path/to/drupal ServerName site.be </VirtualHost> <VirtualHost site1.be:80> DocumentRoot /absolute/path/to/drupal ServerName site1.be </VirtualHost> <VirtualHost site2.be:80> DocumentRoot /absolute/path/to/drupal ServerName site2.be </VirtualHost> Informatics Hans Rossel - www.koba.be
  • 205. Symlink maken Zie ook http://drupal.org/getting-started/6/install/multi-site <?php /*werkwijze: * 1. Maak via cpanel een addon of subdomain * 2. Delete dit subdomain * 3. Doe de symlink voor dit subdomain/addon vb hieronder voor abc.com waarvoor we /abc hebben gedeleted * De bedoeling is dat de subdomeinen verwijzen naar de root via een symlink */ symlink(".", "./abc"); print "Done"; ?> Informatics Hans Rossel - www.koba.be
  • 206. Make symlink with shell access ls -s . abc Informatics Hans Rossel - www.koba.be
  • 207. Onderhoud Als alle sites dezelfde modules hebben, moet je slechts eenmaal update status aanzetten Laat update.php lopen op alle sites Informatics Hans Rossel - www.koba.be
  • 208. UBERCART shopping cart voor Drupal Informatics Hans Rossel - www.koba.be
  • 209. Ubercart Project: http://drupal.org/project/ubercart Hoofdsite: www.ubercart.org http://www.ubercart.org/docs http://www.ubercart.org/forum Vertaling: http://l10n.privnet.biz/translate/languages/nl of http://drupal.org/project/l10n_client Extra plugins http://www.ubercart.org/contrib vb http://www.ubercart.org/contrib/140 Informatics Hans Rossel - www.koba.be
  • 210. Ubercart core modules Cart (ubercart/uc_cart) De shopping cart Order (ubercart/uc_order) Laat je toe bestellingen te ontvangen Product (ubercart/uc_product) Laat je toe producten te maken voor je winkel. Imagecache en cck Imagefield worden gebruikt om afbeeldingen van producten weer te geven Store (ubercart/uc_store) Laat je toe de winkel te beheren. Informatics Hans Rossel - www.koba.be
  • 211. Andere Ubercart core modules Attribute (ubercart/uc_attribute) Geef extra selectiemogelijkheden voor producten. Vb bij verkoop van T-shirts de grootte selecteren. Catalog (ubercart/uc_catalog) Geeft een blok en pagina met producten volgens categorie File Downloads (ubercart/uc_file) Voor verkoop van bestanden (software, e-books, foto's) Notify (ubercart/uc_notify) Verstuur e-mail verwittigingen naar klanten bij checkout en als ze hun bestelling wijzigen. Informatics Hans Rossel - www.koba.be
  • 212. Andere core (vervolg) Payment (ubercart/payment/uc_payment) Payment API activeren om betalingen te kunnen ontvangen en opvolgen. Alle gerelateerde modules zitten in de ubercart/payment map. Reports (ubercart/uc_reports) Bekijk rapporten van je verkopen, klanten en producten. Roles (ubercart/uc_roles) Ken permantente of tijdelijke rollen toe gebaseerd op aankopen. Shipping Quotes (ubercart/shipping/uc_quote) Geef transportkosten weer voor klanten bij het uitchecken. Alle gerelateerde modules zitten in de ubercart/shipping map. Shipping (ubercart/shipping/uc_shipping) Zet verzendingen op voor transportbedrijven met geintegreerde webservices. Taxes (ubercart/uc_taxes) Bereken tax op bestellingen Informatics Hans Rossel - www.koba.be
  • 213. Extra modules Google Analytics for Ubercart (ubercart/uc_googleanalytics) Stuur e-commerce gegevens naar Google Analytics voor rapporten en opvolging. Importer (ubercart/uc_importer) Een interface om producten te importeren via XML Product Kit (ubercart/uc_product_kit) Maak producten die een verzameling zijn van andere producten. Create products that represent collections of other products. For example, if you sold TVs, you could create a collection of CRT, LCD, and Plasma TV products. Informatics Hans Rossel - www.koba.be
  • 214. TOEGANGSCONTROLE Informatics Hans Rossel - www.koba.be
  • 215. Toegangscontrole modules Content access of node privacy by role Taxonomy access Content field permissions Masquerade (of devel) Informatics Hans Rossel - www.koba.be
  • 216. Organic groups Online werkgroepen Mogelijkheid eigen kalender/forum Open of gesloten Mail integratie Toegangsrechten Informatics Hans Rossel - www.koba.be
  • 217. IMPORT-EXPORT Informatics Hans Rossel - www.koba.be
  • 218. Import - Export Views bulk operations + views bonus: csv maken Node import en user import: csv importeren Advanced modules http://drupal.org/project/tw http://drupal.org/project/migrate Informatics Hans Rossel - www.koba.be
  • 220. FEEDAPI + youtube Nodig Cck Feedapi Feedapi Feedapi node Simplepie parser (3rd party) Feedelement mapper Feedapi mapper Feedapi node views Views Views bonus emfield Informatics Hans Rossel - www.koba.be
  • 221. SPAM Informatics Hans Rossel - www.koba.be
  • 222. Spamcontrole Core: ip blokkeren Spam module Voorbeeldweergave Captchas Mollom of akismet Captcha module, recaptcha Informatics Hans Rossel - www.koba.be
  • 223. PERFORMANCE Informatics Hans Rossel - www.koba.be
  • 224. Performance www.drupal-check.org Aggregation van js en css Ongebruikte modules af + db tables wissen Caching Gevorderd Static views “light” modules Lijntje code ipv module Server side: Memcache Apache solr Boost http://drupal.org/project/advcache Front side: Yslow http://wimleers.com/article/improving-drupals-page-loading-performance Informatics Hans Rossel - www.koba.be
  • 225. VIDEO Informatics Hans Rossel - www.koba.be
  • 226. Video Emfield Flash video & ffmpeg Kaltura, openvideo Jquery media Gewoon cck field http://drupal.org/project/video_upload Nieuw: via php stream wrapper http://drupal.org/project/media http://www.lullabot.com/drupal-voices/drupal-voices-43-aaron-winborn-media-module Informatics Hans Rossel - www.koba.be
  • 227. ACQUIA Informatics Hans Rossel - www.koba.be
  • 229. HOOFDSTUK Wegwijs op drupal.org & drupal.be Informatics Hans Rossel - www.koba.be
  • 230. Community / drupal.org Redesign: http://www.disambiguity.com/category/planet-drupal/ Drupal.org http://groups.drupal.org : themagroepen http://drupal.org/planet : aggregator Drupal blogs Www.drupalcon.org Informatics Hans Rossel - www.koba.be
  • 231. Drupal community support Op drupal.org http://drupal.org/handbook: handboeken http://drupal.org/forum: forum http://drupal.org/project/issues: issues Op drupal.be http://www.drupal.be/forum: forum beginner Binnenkort ook beginners handboek voor ontwikkelaars in Nederlands IRC http://drupal.org/irc : Freenode https://addons.mozilla.org/en-US/firefox/addon/16: Chatzilla Mailinglijsten http://drupal.org/mailing-lists: Mailman lijsten Informatics Hans Rossel - www.koba.be
  • 232. Community in Belgie www.drupal.be: Redesign: wat is Drupal, referenties, showcases, handboek, forum, agenda,... (voorjaar 2009) http://www.drupal.be/forum/19 Community meetings Drupal gebruikers groep drupaljam.nl Een Drupal ontwikkelaar zoeken/kiezen Drupal referenties drupal.org username: http://drupal.org/profile/country/Belgium: gesorteerd op, meritocracy, lid sinds drupal.be username:http://drupal.be/profile/profile_kennis/Expert+(gebruik+drupal+dagelijks ): idem sortering, lid sinds Drupal.be: begin 2009: lijst service providers Informatics Hans Rossel - www.koba.be
  • 233. Audio & Video Audio http://www.lullabot.com/audiocast http://www.volacci.com/seo-podcast: SEO Video http://drupal.org/handbook/customization/videocasts http://drupal.org/videocasts: video http://www.drupaltherapy.com: multimedia recepten http://mustardseedmedia.com/podcast: Voor churches & ministries http://www.drupaldojo.com/ Community opleiding http://www.archive.org/search.php?query=drupal%20OR%20drupalcon Drupalcons Op blip.tv: http://blip.tv/search?q=drupal&x=0&y=0 http://drupalmao.com: gossip http://movielibrary.lynda.com/html/modPage.asp?ID=620: Tutorials reeks www.doitwithdrupal.com: van de conferentie dec 2008 (95$) http://lvb.net/item/7098: FOSDEM februari 2009 Informatics Hans Rossel - www.koba.be
  • 234. FREELANCERS Informatics Hans Rossel - www.koba.be
  • 235. JOBTRENDS Informatics Hans Rossel - www.koba.be
  • 236. Freelancers Hoe kan je developers contacteren die tegen betaling customs modules maken en hoe zit het dan met de intellectuele eigendom, contaminatieprincipe van OpenSource. drupal.be: http://drupal.be/support drupal.org developers van modules + paid services forum (http://drupal.org/paid-services) groups.drupal.org: marketplace http://www.drupaljob.com/ http://www.drupalancers.com/ http://sourceforge.net/services/buy/service_providers.php?words=drupal http://drupalsn.com/companies www.getafreelancer.com http://www.odesk.com Informatics Hans Rossel - www.koba.be
  • 237. Forum Core forum Advanced forum module: Extra author pane: foto en extra informatie, integreert met veel andere social networking modules User points User titles Informatics Hans Rossel - www.koba.be
  • 238. NIEUWSBRIEVEN & e-mail integratie Informatics Hans Rossel - www.koba.be
  • 239. Mail interactie Simplenews Subscriptions of Notify of Watcher Actions & Workflow/Rules & Views Bulk operations Messenger & Notifications framework Webform Mailhandler Informatics Hans Rossel - www.koba.be
  • 240. Nieuwsbrieven 3 voornaamste mogelijkheden Simplenews: eenvoudig en goedkoop, geen bounce handling, beperkte statistieken Campaignmonitor of Mailchimp integratie: full bounce handling, statistieken, whitelisting, betalend Civimail (onderdeel van Civicrm) Informatics Hans Rossel - www.koba.be
  • 241. Simplenews www.drupal.org/project/simplenews Voor versturen van html mail: http://drupal.org/project/htmlmail (Emogrifier helpt) http://drupal.org/project/rel_to_abs: absolute paden in links en afbeeldingen in body Mimemail niet meer gebruiken: bevat bugs en is niet meer onderhouden Extra modules: analytics, on register,... Let op: geen poormanscron gebruiken (dubbele verzending! + niet betrouwbare tijdstippen) Informatics Hans Rossel - www.koba.be
  • 243. Contemplate http://drupal.org/project/contemplate In database of sites/all/contemplates Voordelen: Geldt voor alle themes (ander niveau dan theme layer) Voor search, rss feeds en nieuwsbrieven Informatics Hans Rossel - www.koba.be
  • 244. Body & footer simplenews-newsletter-body--1126.tpl.php simplenews-newsletter-footer--1126.tpl.php Velden printen <?php print $node->field_nieuwsbrief_link1[0]['view']; ?> $foto = theme('imagecache','square100x100',$node->field_nieuwsbrief_foto1[0]['filepath']); print '<div class="field-field-foto">' . $foto . '</div>'; <?php print $node->field_nieuwsbrief_intro[0]['view']; ?> Informatics Hans Rossel - www.koba.be
  • 245. JQUERY Informatics Hans Rossel - www.koba.be
  • 246. Jquery Voordelen Unobtrusive Klein en licht Trekt goed op css, eenvoudig te leren Browser compatibiliteit In Drupal core, wederzijds verbonden met Drupal Concurrenten MooTools, Prototype/Scriptaculous Let op: conflicten en performance bij 2 frameworks Informatics Hans Rossel - www.koba.be
  • 247. Populairiteit jquery groeit B: http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx Bron: http://www.google.com/trends?q=jquery%2C+mootools%2C+yahoo+ui%2C+dojo+(toolkit%7Cjavascript%7Clibrary%7Cframework)%2C+prototype+(toolkit%7Cjavascript%7Clibrary%7C Informatics Hans Rossel - www.koba.be
  • 248. Jquery Nadelen In sommige tests & Browsers trager dan de concurrenten In snelle evolutie waardoor de met Drupal core geleverde versie niet meer up-to-date is. Drupal 6.0 to 6.2 hebben jQuery 1.2.3. Vanaf Drupal 6.3 was dit jQuery 1.2.6 (laatste versie). Andere optie: http://drupal.org/project/jquery_update, maar Eigenlijk een core hack (misc folder aanpassen) Versie en compatibiliteitsproblemen Informatics Hans Rossel - www.koba.be
  • 249. Jquery toevoegen http://www.learningjquery.com/2008/06/updated-jquery-bookmarklet scripts.js maken in theme map met $(document).ready( function() { $(‘p’).hide(‘slow’); }); In template.php drupal_add_js(path_to_theme().‘scripts.js’, ‘theme’, ‘header’); of via .info file toevoegen aan theme map Jquery wordt automatisch geladen bij drupal_add_js Informatics Hans Rossel - www.koba.be
  • 250. Voorbeelden Informatics Hans Rossel - www.koba.be
  • 253. Jquery plugins http://plugins.jquery.com/ Drupal Jquery pluging manager http://drupal.org/project/jquery_plugin http://drupal.org/project/jqp http://drupal.org/project/jq Drupal 7 in core: http://drupal.org/node/315100 Informatics Hans Rossel - www.koba.be
  • 254. PRAKTIJK Informatics Hans Rossel - www.koba.be
  • 255. Bekijken installaties Welk is de gebruikte methode om je homepagina een andere layout te geven dan je onderliggende pagina's? Meerdere websites hosten vanop één drupal installatie. Principe van dynamisch themen. Informatics Hans Rossel - www.koba.be
  • 256. Drupal 7: Nieuw Betere installer Paswoord encryptie: betere bescherming van rainbow tables Ingebouwde automatische module en theme installer en updater Verbeterde meertaligheid Verbeterde tijdzone support PHP stream wrappers Javascript overlays (jquery ui in core) Informatics Hans Rossel - www.koba.be
  • 257. Drupal 7: Usability & UX Wat? Gebruiksvriendelijkheid “Given two functionally equivalent content management systems, the simplest one should be selected.” (http://buytaert.net/ockhams-razor- principle-of-content-management-systems) Reactie op “van developers voor developers” imago & tests in 2008 van University Minnesota ( http://buytaert.net/first-results-from-usability-testing ) Mark Bolton: Redesign van drupal.org en UX Drupal 7. Informatics Hans Rossel - www.koba.be
  • 258. Drupal 7: Database laag Wat? Drupal gebruikt nu de php pdo (php data objects) database abstractielaag Voordeel? Drupal zal niet enkel op MySQL/PostGreSQL kunnen draaien maar ook op MSSQL, Oracle, SQLite, … Microsoft (hoofdsponsor Drupalcon SF 2010) reageerde positief en sponsorde alvast de afwerking van de MSSQL pdo en de corresponderende Drupal module Master slave en transactionmsupport Infor atics Hans Rossel - www.koba.be
  • 259. Drupal 7: Unit testing Wat? Automatische tests: http://drupal.org/node/363580#comment-2665246 18202 tests automatisch uitgevoerd http://qa.drupal.org/pifr/test/35713 Voordeel Informatics Hans Rossel - www.koba.be
  • 260. Drupal 7: Semantic web Wat? Het toevoegen van betekenis (semantiek) aan data door machines wordt gedaan door deze met ontologieën, beschrijvingen van concepten en de relaties daartussen, in metadata uit te breiden. Zo kunnen er automatisch relaties tussen concepten gelegd worden. Het W3C heeft hiervoor onder andere de RDF-standaard (Resource Description Framework) ontwikkeld. Automatisch toevoegen van RDFa data aan de html van Drupal: auteursinformatie, indiendatum, ... Voordeel? Met SPARQL & FOAF verbanden leggen tussen data Informatics Hans Rossel - www.koba.be
  • 261. Drupal 7: Fields in core Wat? CCK in core, was een van de basiscomponenten van uitgebreidere sites Voordeel? Stabielere basis Conceptueel geabstraheerd: fields op content, taxonomie, users, elk object door module gedefinieerd (hoeft niet in mysql te zitten) Vb The Examiner: MongoDB dank zij Fields API Combinatie met Views3 query builder is zeer krachtig.s Informatics Hans Rossel - www.koba.be
  • 262. Drupal als Product Distributies & Installatieprofielen Probleem: Een basisinstallatie van Drupal heeft geen full-option mogelijkheden (low-end kritiek). Drupal mag niet te zwaar zijn, enkel noodzakelijke in core, moet vooral bruikbaar zijn als framework (high-end kritiek). Oplossing: Distributies/Installatieprofielen aangepast aan doelgroep Informatics Hans Rossel - www.koba.be
  • 263. Drupal 7 Demo Informatics Hans Rossel - www.koba.be
  • 264. Wordt vervolgd... hans.rossel@koba.be Twitter: @haro www.koba.be Informatics Hans Rossel - www.koba.be