Drupal Skils Lab 302Labs
-
Upload
ahmad-zain -
Category
Technology
-
view
243 -
download
0
Transcript of Drupal Skils Lab 302Labs
![Page 1: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/1.jpg)
Drupal Training
SkillsLab – 302Labs
Sep, 12 ~ 20, 2014
![Page 2: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/2.jpg)
Main Nodes
• Welcome and Introduction• What is Drupal ?• What is Drupal Egypt?• Drupal Ingredients• Drupal Terminology• Drupal Basic Layouts• How Drupal dealing with User Requests • Thinking Like Drupal• Drupal Development environment setup• Drupal installation and Discovery• Configuration Before Code
![Page 3: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/3.jpg)
This is Me ..
Ahmad Mohamad Zain
TeQniaty CTO/Founder
Egypt Com. Manager
You can fiend me at
Twitter: @iahmadzain
Skype : iahmadzain
![Page 4: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/4.jpg)
You ?
![Page 5: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/5.jpg)
What is Drupal Egypt
The Drupal community in Egypt
![Page 6: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/6.jpg)
Why Drupal ?
![Page 7: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/7.jpg)
Why Drupal ?
• Drupal is open.
• Drupal is Web Development. (event-driven ..)
• Drupal is Social. (User System and Roles)
• Drupal is Content. (SEO and etc..)
• Drupal is Scalable. (10m pages & 20K r/s)
• Drupal is Design. (base themes and Omega)
• Drupal is Everywhere. (big, med, small, tiny)
• Drupal is Secure.(OWASP)
![Page 8: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/8.jpg)
Why Drupal
![Page 9: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/9.jpg)
Drupal VS WP VS Joomla
![Page 10: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/10.jpg)
![Page 11: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/11.jpg)
What is Drupal
![Page 12: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/12.jpg)
What is Drupal
Drupal is a free, open-source web development platform for online content and user communities. Drupal powers some of the busiest sites on the web, and can be adapted to virtually any visual design. Drupal runs over a million sites, including WhiteHouse.gov, World Economic Forum, Stanford University, and Examiner.com.Drupal is a unique combination between CMS and Framework there power and the simplicity.
Acquia CEO.
![Page 13: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/13.jpg)
What is Drupal
• Drupal Pros:Can do almost anything. Seriously. Drupal was designed to get new features using tons of little modules. Many of these modules are maintained by professional developers for large clients, but you still get them for free. (Feature Rich,Advanced Admin, Design Customization, Content Types and WYSIWYG, Scalable, User Collaboration)
• Drupal Cons:If you're not a developer, Drupal has a reputation for being difficult. However, the recent release of Drupal 7 brings huge improvements that make it much easier for normal users. Still, it's not quite as easy as WordPress.
![Page 14: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/14.jpg)
What is Drupal
• Structure– Nodes & Content types (Drupal Secret Points)Each item of content in your site is a node. A node has several default fields. A node can be one of a number of content types.– Navigation menusSEO and Path – Blocks– Taxonomies (Categories we can say ..)– Views (The magic of playing with database via GUI)– Panels (Play with your layout)
![Page 15: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/15.jpg)
Think Like Drupal
![Page 16: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/16.jpg)
Think Like Drupal
• How Drupal Works :
![Page 17: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/17.jpg)
Source: drupal.org
![Page 18: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/18.jpg)
Think Like Drupal
• General Concepts:– Node (Content)
– Entity types• An entity type is a useful abstraction to group together fields. Entity types are used to store and display data,
which can be nodes (content), comments, taxonomy terms, user profiles, or something custom developed.
– Comment
– Taxonomy• Drupal has a system for classifying content known as taxonomy. This is provided by the core Taxonomy module.
You can define your own vocabularies, or groups, of taxonomy terms, and add terms to each vocabulary. Each vocabulary can then be attached to one or more content types, and in this way, nodes on your site can be grouped into categories, tagged, or classified in any way you choose.
– User
– Module• A module is software (code) that extends Drupal functionality. Modules fall into one of three categories:
• Core modules are those included with the main download of Drupal. These can be turned on or off without downloading additional components. Examples include Blog, Book, Poll, or Taxonomy.
• Contributed modules are downloaded from the Modules download section of drupal.org, and installed within your Drupal installation. Examples include Panels, Views or Metatag.
![Page 19: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/19.jpg)
Think Like Drupal
– Regions & Blocks– Menus
• There are four standard menus in Drupal 7:• The Main menu is built by site administrators and displayed automatically in the page header of many themes (and if not,
you can enable their blocks to display them).• Management is the administration menu, and is presented in the Admin toolbar.• Navigation is a catch-all menu that usually contains links supplied by modules on your site.• User menu contains links to the User account and the logout link.
– Theme– Views
• Although not all sites have Views, most sites include the Views module because of the excellent tools it provides. Views allows people to choose a list of nodes or other entities and present them as pages, blocks, RSS feeds, or other formats. The main use case for views is to create dynamically updating lists to content (for example, a listing of latest news), basedon properties of that content (in the case of the news listing, that the content type is “News” and sorted by publication date).
– Database• Drupal stores information in a database. Within this database, each type of information has its own database table. For
example, the basic information about the nodes of your site are stored in the Node table, and each field stores its data in a separate table (which Drupal creates automatically). Comments and Users also have their own database tables, as do roles, permissions, and other settings.
• The most common database for Drupal is MySQL. However, you can also run Drupal on other database systems, such as PostgreSQL, as well.
– Path– Bootstrap
![Page 20: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/20.jpg)
Drupal Dev. Environment
![Page 21: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/21.jpg)
Drupal Dev. Environment
• Drupal Is flexible but well tested on ..
– Apache
– MySQL, PGSQL, SQLite, MariaDB
– Linux
• System Requirement
– MySQL 5.0.15 (PDO),SQLite 3.3.7
– PHP 5.4 https://www.drupal.org/requirements/php
![Page 22: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/22.jpg)
Drupal Development environment setup
![Page 23: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/23.jpg)
Drupal Development environment setup
• Cloud Like : Drupalgardens(http://www.drupalgardens.com)
• DDS, VPS, PERSONAL (MAC Server, Linux, Windows)
• New … Windows Azure
![Page 24: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/24.jpg)
Break Q & A
![Page 25: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/25.jpg)
Drupal Installation And Discovery
![Page 26: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/26.jpg)
Drupal Installation And Discovery
• Drupal fresh download (current version 7.28)
• Tools
– XAMPP or WAMPP or MAMPP
(XAMPP is the Hero)
• https://www.apachefriends.org/index.html
– IDEs (PHPStorm, KOMODO, SUBLIM, APTANA)
• Any PHP or Text Editor will be helpful the top recommended PHPSTORM
![Page 27: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/27.jpg)
Drupal Installation And Discovery
• Files and Folders Structure
![Page 28: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/28.jpg)
![Page 29: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/29.jpg)
Drupal Installation And Discovery
• Admin area (http://test.local/admin)
• Site Configuration
• Users and Roles
• Modules
• Content Types
• Blocks
• Views
• Appearance
![Page 30: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/30.jpg)
Drupal Configurations
![Page 31: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/31.jpg)
Drupal Configurations
$databases = array ('default' => array (
'default' => array (
'database' => ’MyDataBase','username' => ’DBUserName,'password' => ’DBPassword','host' => 'localhost','port' => '','driver' => 'mysql','prefix' => '',
),),
);
Sites/default/settings.php
![Page 32: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/32.jpg)
Drupal Configurations
http://YOUR-DRUPAL-TEST-SITE/admin/config
![Page 33: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/33.jpg)
Q & A
![Page 34: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/34.jpg)
Drupal Cases
![Page 35: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/35.jpg)
Drupal Cases
The-Economisthttp://www.economist.com
Views & BlocksMigrateComments
![Page 36: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/36.jpg)
Drupal Cases
Alshari3 News
LocalizationViews & BlocksMega MenusTwitter Module
![Page 37: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/37.jpg)
Drupal Cases
For More Cases Visit this link
http://www.drupalshowcase.com/site-industries/Education
![Page 38: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/38.jpg)
Extending the Drupal Core
![Page 39: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/39.jpg)
Extending the Drupal Core
• Drupal Distros. (Distributions)Distributions provide site features and functions for a specific type of site as a single download containing Drupal core, contributed modules, themes, and pre-defined configuration. They make it possible to quickly set up a complex, use-specific site in fewer steps than if installing and configuring elements individually.
• OpenPublic• OpenPublish• Joulio• Erpal• Common• Open Atrium ……
![Page 40: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/40.jpg)
Extending the Drupal Core
• Drupal Themes. (https://www.drupal.org/project/project_theme)
Themes allow you to change the look and feel of your Drupal site. You can use themes contributed by others or create your own to share with the community. Contributed themes are not part of any official release and may not have optimized code/functionality for your purposes. You can also create a sub-theme of an existing theme. A sub-theme inherits a parent theme's resources.
• Partick• Omega & Omega Sub-Theme• Seven For Admin• Adabtive Theme
![Page 41: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/41.jpg)
Extending the Drupal Core
• Drupal Modules. (https://www.drupal.org/project/project_module )
Extend and customize Drupal functionality with contributed modules. • Views• Chaos Tool Suite (Ctools)• Display Suite• Backup and Migrate• FB Connect (Facebook integration also OpenGraph) • Libraries API• Date• WebForm• Entity API• IMCE• WySwiyg & CKEditor• LDAP • CAPATCHA
![Page 42: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/42.jpg)
Drupal Views Part I
![Page 43: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/43.jpg)
Drupal Views Part I
• Understanding Views vs. custom code.
– Custom code advantages
• Complete Control
• Huge SQL
• Complete Knowledge
• Simplicity
• Revision control systems like Git, TFS, CVS, SVN.
![Page 44: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/44.jpg)
Drupal Views Part I
• Understanding Views vs. custom code.– Views advantages.
• Change behavior without changing code.• Many options for presentation.• No PHP Code Knowledge needed (Like BB).• Data is Safe.• Open architecture.• Community benefit.• Reuse views.• Other Modules integrations.• Panels integration. • Programmatic handling of views.• Documentation.• Page, menu and block integration. • Exposed filters a powerful tool.
![Page 45: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/45.jpg)
Drupal Views Part I
• Installing Views and dependences.
![Page 46: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/46.jpg)
Drupal Views Part I
• Enabling Views.
• Exploring and creating new View.
![Page 47: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/47.jpg)
Hands-On Drupal
![Page 48: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/48.jpg)
Hands-On Drupal
• Create a DrupalGarden Account
(http://drupalgardens.com)
• Start Thinking with your project
• Draw your Proto Type
• Apply to your site on cloud.
• Export to your local Drupal project
![Page 49: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/49.jpg)
Drupal IngredientsOR
Main Components
![Page 50: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/50.jpg)
Drupal Ingredients and Main Components
DrupalNodes & Content
Types
Navigation menus
Blocks Taxonomies
Views
Panels
![Page 51: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/51.jpg)
Drupal Terminology
![Page 52: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/52.jpg)
Drupal Terminology
![Page 53: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/53.jpg)
Drupal Core {Core APIs, Core modules, Core Themes}From the base installation package … not a distribution or installation profile
Contirb. ModulesDropal.org or drupalmodules.com
Custom ModulesYour custom modules
Themes Contirb. Themes (and/or) Purchased Themes (and/or) Your Custom Theme
Theme is a group of templates In Joomla Template means Theme
Contents (HTML,TEXT,Cashed Data, Variables etc…)
Attached Files, Images, Media … etc
Settings
Content Types
Nodes Views User Roles URL Aliases
Cats Blocks Menus ACL
DB
Code
![Page 54: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/54.jpg)
Drupal Basic Template Structure
![Page 55: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/55.jpg)
Drupal Basic Template Structure
node.tpl.php
menu.tpl.php or block.tpl.php
block.tpl.php
block.tpl.php
block.tpl.php
html.tpl.php
page.tpl.php
![Page 56: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/56.jpg)
Drupal Basic Template Structure
html.tpl.php
page.tpl.php
Regions{Blocks}
![Page 57: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/57.jpg)
Drupal Basic Template Structure
![Page 58: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/58.jpg)
Drupal Best Practices
![Page 59: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/59.jpg)
Drupal Best Practices
• Register to http://drupal.org
• Join some groups @ http://groups.drupal.org
• File Structure
– Do not code in the core (never ever) !!
– Create a separated folders in /sites/all/modules
• contirb (for the modules came from drupal.org)
• features (exports via Features module)
• custom (that you coded it)
![Page 60: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/60.jpg)
Drupal Module Development
![Page 61: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/61.jpg)
Drupal Module Development
hook clean hook
Module
![Page 62: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/62.jpg)
Drupal Module Structure
![Page 63: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/63.jpg)
Drupal Module Structure
Module contains
Files define the module to Drupal
Sites/all/modules/[contirb],[custom],[futures] Module
Required
Module.info Module.module
Optional
.install, READEME.txt,
.inc
![Page 64: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/64.jpg)
Drupal useful tools
![Page 65: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/65.jpg)
Drupal useful tools
• IDE
– PHPStorm : http://jetbrains.com/
– KOMODO : http://komodoide.com/
– Sublime Text : http://www.sublimetext.com/
• Devel Module
– http://drupal.org/project/devel
![Page 66: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/66.jpg)
Drupal & User Request
![Page 67: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/67.jpg)
Browser
Server
.htaccess Site.com
Bootstrap.inc
Menues.inc
DB
hook_menu()
Check for all URLS
Modules
User Access
Theme System
If not 404
Server
Check For shared resources like
COOKIES
Any like Apache according to the
configurations
Request
Response
![Page 68: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/68.jpg)
Drupal Event Driven Hook System
![Page 69: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/69.jpg)
Drupal Event Driven Hook System
Drupal Events
User Register
Node Display
Content Searched
Form is Processed
Saving a Comment
Menus has been built
![Page 70: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/70.jpg)
Drupal Event Driven Hook SystemHook Naming style …
mymodule_name
mymodule_[permission]
Drupal Hook Name
[hook]_permission
my_hook()
My new function
![Page 71: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/71.jpg)
Drupal Event Driven Hook System
• function mymodule_myfunction(){ module_invoke_all(‘myhook’,$vars); }
• function mymodule_myhook(){}
• function yourmodule_myhook(){}
Any Module can Define a hook.
![Page 72: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/72.jpg)
Drupal Menu System
![Page 73: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/73.jpg)
Drupal Menu System
• hook_menu().– function mymodule_menu () {}
• To know if any hook needs any parameters to be passed to the hook function you can know that from … http://api.drupal.org
function mymodule_menu() {$items['abc/def'] = array(
'page callback' => 'mymodule_abc_view',);return $items;
}
function mymodule_abc_view($ghi = 0, $jkl = '') {// ...
}
![Page 74: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/74.jpg)
Drupal Menu System
http:// [site.com] /
{node}
{user}
…
/ [arg-1] / [arg-2]
Passing URL arguments to hook_function
![Page 75: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/75.jpg)
Drupal Menu System
Passing URL arguments to hook_function
function mymodule_menu() {$items['abc/def'] = array('page callback' => 'mymodule_abc_view','page arguments' => array(1, 'foo'),
);return $items;
}
![Page 76: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/76.jpg)
Drupal Menu System
Passing URL arguments using wildcards
function mymodule_menu() {$items['abc/%/def'] = array('page callback' => 'mymodule_abc_view','page arguments' => array(1, 2),
);return $items;
}
![Page 77: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/77.jpg)
Drupal Menu System
Passing URL arguments using auto-loaders
function mymodule_menu() {$items['abc/%node/def'] = array('page callback' => 'mymodule_abc_view','page arguments' => array(1, 2),
);return $items;
}
![Page 78: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/78.jpg)
Drupal Menu System
• What is Contextual links and Menu Tab :
![Page 79: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/79.jpg)
Drupal Database Layer
![Page 80: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/80.jpg)
Drupal Database Layer
• PDO (PHP Data Opjects)
• Any DB that PHP supports (MySQL, SQLite ..)
• Master and Slave Replications
• more.....
![Page 81: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/81.jpg)
Drupal SQL Queries
![Page 82: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/82.jpg)
Drupal SQL Queries
• Static (the normal SELECT methods)
– SELECT x,y,z FROM table WHERE v = b
• Dynamic (Alterable, Strong, Heavy)
– db_select()
![Page 83: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/83.jpg)
Drupal DB Table Creation and altering
![Page 84: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/84.jpg)
Drupal DB Table Creation and altering
• Mymodule.install – The file
• hook_schema();
• hook_update_N();
• Schema Module
![Page 85: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/85.jpg)
Drupal DB Querying
![Page 86: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/86.jpg)
Drupal DB Querying
• SELECT QUERY
• INSERT QUERY
• UPDATE QUERY
• MERGE QUERY
• DELETE QUERY
![Page 87: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/87.jpg)
Drupal Theming
![Page 88: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/88.jpg)
Drupal Theming
• CSS creation to control the Layout
• Appearance Design
• Changing The Output (HTML output)
![Page 89: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/89.jpg)
Drupal Theming
Theme contains
Files define the New Theme to Drupal
Sites/all/themes/mytheme Theme
Required
theme.info .tpl.php
Optional
Template.tpl.php(if we will pass
args to our theme)
![Page 90: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/90.jpg)
Drupal Theming
node.tpl.php
node.tpl.php
node.tpl.php
Block.tpl.php
Block.tpl.php
Page.tpl.php
Regon.tpl.phpRegon.tpl.php
![Page 91: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/91.jpg)
Drupal Theming
• Dynamic Templates
– node.tpl.php
– node—{nodetype}.tpl.php
• node—article.tpl.php
– “-” separator & “—” specify the targeted override
![Page 92: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/92.jpg)
Drupal Theming
• User Module .tpl files
– /modules/user/….tpl.php
![Page 93: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/93.jpg)
Drupal Theming
• Mytheme.info (Let Drupal know your theme)
• Page.tpl.php (Control the layout)
• Template.php (Vars and override theme functions)
![Page 94: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/94.jpg)
Drupal Theming
• Most Popular Theme Vars. :
![Page 95: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/95.jpg)
Drupal Entities Module
http://www.youtube.com/watch?v=cu4h-xhwb2k
![Page 96: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/96.jpg)
Drupal Panels Modulehttp://goo.gl/mHKcKz
![Page 97: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/97.jpg)
Drupal Best Practices
• Be a friend for Drupal APIs @ https://api.drupal.org/api/drupal
• Use Coding Standards @ https://drupal.org/node/318
• 01114943403 Ahmad Zain
![Page 98: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/98.jpg)
Q & A
![Page 99: Drupal Skils Lab 302Labs](https://reader033.fdocuments.us/reader033/viewer/2022052413/55a20afc1a28abd24e8b4578/html5/thumbnails/99.jpg)
Thank You !
@iahmdzain
01114943403