SlideShare a Scribd company logo
Magento 2
View Layer Evolution
Sergey Shymko
Software Engineer, Magento,
a division of X.commerce, Inc. (an eBay company)
• Theme/Skin – graphical appearance
of an application
• Magento distinguishes theme & skin
• Responsibility
• File types
• Web-accessibility
Introduction
• Theme – markup & text, blocks presence & positioning
• Theme files – dynamically processed, no web access
Magento Theme
• Skin – look and feel of a theme, colors & styles
• Skin files – static, web-accessible
Magento Skin
• Skins are located separately from themes
• Any skin can be chosen for any theme
• Incompatible skin can be chosen for a theme
“example” package
“default” theme
“mobile” theme
“default” skin
“modern” skin
“simple” skin
Magento 1.x Skin
• Skin belongs to one theme only
• Skin is located within a theme
• Skin files web-access challenge
“example” package
“default” theme
“mobile” theme
“default” skin
“modern” skin
“simple” skin
Magento 2 Skin
• New skin for every locale
• Inconsistent configuration: locale + localized skin
“example” package
“default” theme
“default” skin
“german” skin
“french” skin
Magento 1.x Skin Localization
• Skin provides files for multiple locales
• Consistent configuration: locale
“example” package
“default” theme
“default” skin
“de_DE” locale
“fr_FR” locale
Magento 2 Skin Localization
Magento 2
View Layer Modularity
Package Theme/Skin
1. <current> <current>
2. <current> <default>
3. <current> “default”
4. “base” “default”
<xxx> – configured name
“xxx” – exact name
<current> package
“base” package
Magento 1.x View Layer Fallback
<current>
<default>
“default”
“default”
• Contains pseudo-modular view files
• app/design/frontend/base/default/…
• catalog
• checkout
• cms
• sales
• …
• Modules depend on “base/default”
Module aliases
Magento 1.x “base/default” Theme/Skin
• app/code/<pool>/<Namespace>/<Module>
• view
• <area>
• layout.xml
• template.phtml
• logo.png
• style.css
• Modules are independent of themes
Modular View Files
Skin files
Theme files
• Referring modular file
<Namespace>_<Module>::file.ext
• Omit module scope
• If template used solely within its own module
• In module’s configuration file*
• In module’s layout update file*
• In module’s CSS file*
* - not implemented yet
Module Scope
Package Theme
1. <current> <current>
2. <current> <default>
2. <current> “default”
3. “base” “default”
3. Module theme files
<xxx> – configured name
“xxx” – exact name
<current> package
Module files
Theme Files Fallback
<current> theme
“default” theme
JavaScript lib
Module files
Theme Skin
1. <current> <current>
2. <current> “default”
3. “default” <current>
4. “default” “default”
5. Module skin files
6. JavaScript libraries
<current> package
<current> theme
“default” theme
Skin Files Fallback
<current> skin
“default” skin
<current> skin
“default” skin
• Single interface for skin and JS lib files
• Simplified HTML <head> tag manipulation
• Skin can override JS lib files
• Skin may require specific version of JS lib
JavaScript Libraries Fallback
• Need web-access
• Modular skin files
• app/code/<pool>/<Namespace>/<Module>/view
• Skins
• app/design/<area>/<package>/<theme>/skin/<skin>
• Publication – copying to web-accessible location
Skin Files Web-Access
• Need processing
• Relative URLs
• URLs with module scope
• Don’t need processing
• Absolute URLs
CSS Files Processing
Magento 2
Containers
Container vs Block
• Block – unit of a page output
• Container – unit of a page structure
• Container consists of
• Blocks
• Containers
• Container renders all children
Containers in Layout Updates
<container> directive attributes:
• name – unique name
• label – human-readable label
• html{Tag,Id,Class} – HTML tag name & attributes
<?xml version="1.0"?>
<layout version="2.0">
<example_handle>
<container name="root_container" label="Root Container" htmlTag="div">
<block type="Mage_Core_Block_Template" name="block1" template="1.phtml"/>
<container name="nested_container" label="Nested Container"/>
</container>
Magento 2
Page Types
Magento 1.x Page Rendering
• Layout handle – instructions of visual elements positioning
and properties
• Controller uses arbitrary layout handles
Page Types
• Page types – special layout handles
• Controller uses one page type only
• Page type may inherit a page type
• Inherited page types are loaded implicitly
Page Types in Layout Updates
Layout handle attributes:
• type="page" – distinguish page type
• parent – ancestor page type
<?xml version="1.0"?>
<layout version="2.0">
<default type="page">
<block type="Mage_Core_Block_Template" name="block1" template="1.phtml"/>
</default>
<example_handle type="page" parent="default">
<block type="Mage_Core_Block_Template" name="block2" template="2.phtml"/>
</example_handle>
Containers & Page Types Usage
The Visual Design Editor
Page type breadcrumbs
Container with the block
Block
drag & drop
Summary
• Magento 2 Features
• Skin files relocation & localization
• Modular view files
• Containers
• Page types
• Links
https://github.com/magento/magento2
https://wiki.magento.com/display/MAGE2DOC
https://wiki.magento.com/display/MAGE2PROJECT
Thank You!
Q & A
Sergey Shymko
sergey.shymko@magento.com

More Related Content

Similar to Magento 2 View Layer Evolution

Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
Ivan Chepurnyi
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
kevinvw
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
Kostas Mavridis
 

Similar to Magento 2 View Layer Evolution (20)

Magento mega menu extension
Magento mega menu extensionMagento mega menu extension
Magento mega menu extension
 
Magento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module developmentMagento 2.0: Prepare yourself for a new way of module development
Magento 2.0: Prepare yourself for a new way of module development
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5
 
Advanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojoAdvanced guide to develop ajax applications using dojo
Advanced guide to develop ajax applications using dojo
 
IBM Digital Experience Theme Customization
IBM Digital Experience Theme CustomizationIBM Digital Experience Theme Customization
IBM Digital Experience Theme Customization
 
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
How to Write Custom Modules for PHP-based E-Commerce Systems (2011)
 
Why I liked Mezzanine CMS
Why I liked Mezzanine CMSWhy I liked Mezzanine CMS
Why I liked Mezzanine CMS
 
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
Modul-Entwicklung für Magento, OXID eShop und Shopware (2013)
 
Magento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kcMagento 2 theming - knowledge sharing session by suman kc
Magento 2 theming - knowledge sharing session by suman kc
 
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdfITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
ITB_2023_Extend_your_contentbox_apps_with_custom_modules_Javier_Quintero.pdf
 
Themes and layouts
Themes and layoutsThemes and layouts
Themes and layouts
 
Intro to Drupal Module Developement
Intro to Drupal Module DevelopementIntro to Drupal Module Developement
Intro to Drupal Module Developement
 
The Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has ArrivedThe Time for Vanilla Web Components has Arrived
The Time for Vanilla Web Components has Arrived
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
EoinWoods_WhereDidMyArchitectureGoPreservingSoftwareArchitectureInItsImplemen...
 
dmBridge & dmMonocle
dmBridge & dmMonocledmBridge & dmMonocle
dmBridge & dmMonocle
 
DevCon - Branding the LMS for your institution - Michael Garner, Blackboard
DevCon - Branding the LMS for your institution - Michael Garner, BlackboardDevCon - Branding the LMS for your institution - Michael Garner, Blackboard
DevCon - Branding the LMS for your institution - Michael Garner, Blackboard
 
Magento 2 - Getting started.
Magento 2 - Getting started.Magento 2 - Getting started.
Magento 2 - Getting started.
 
HTML5, just another presentation :)
HTML5, just another presentation :)HTML5, just another presentation :)
HTML5, just another presentation :)
 

More from Sergii Shymko

More from Sergii Shymko (13)

Magento 2 Changes Overview
Magento 2 Changes OverviewMagento 2 Changes Overview
Magento 2 Changes Overview
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Developing Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with MagentoDeveloping Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with Magento
 
Black Magic of Code Generation in Magento 2
Black Magic of Code Generation in Magento 2Black Magic of Code Generation in Magento 2
Black Magic of Code Generation in Magento 2
 
Composer in Magento
Composer in MagentoComposer in Magento
Composer in Magento
 
Magento 2 Code Migration Tool
Magento 2 Code Migration ToolMagento 2 Code Migration Tool
Magento 2 Code Migration Tool
 
Magento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions DistributionMagento 2 Composer for Extensions Distribution
Magento 2 Composer for Extensions Distribution
 
Magento Performance Toolkit
Magento Performance ToolkitMagento Performance Toolkit
Magento Performance Toolkit
 
Developing Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with MagentoDeveloping Loosely Coupled Modules with Magento
Developing Loosely Coupled Modules with Magento
 
Running Magento 1.x Extension on Magento 2
Running Magento 1.x Extension on Magento 2Running Magento 1.x Extension on Magento 2
Running Magento 1.x Extension on Magento 2
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2
 
Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2Composer for Magento 1.x and Magento 2
Composer for Magento 1.x and Magento 2
 
Magento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration ToolsMagento 1.x to Magento 2 Code Migration Tools
Magento 1.x to Magento 2 Code Migration Tools
 

Recently uploaded

Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 

Recently uploaded (20)

ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-4 Notes for II-II Mechanical Engineering
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical EngineeringIntroduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
Introduction to Machine Learning Unit-5 Notes for II-II Mechanical Engineering
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 

Magento 2 View Layer Evolution

  • 1.
  • 2. Magento 2 View Layer Evolution Sergey Shymko Software Engineer, Magento, a division of X.commerce, Inc. (an eBay company)
  • 3. • Theme/Skin – graphical appearance of an application • Magento distinguishes theme & skin • Responsibility • File types • Web-accessibility Introduction
  • 4. • Theme – markup & text, blocks presence & positioning • Theme files – dynamically processed, no web access Magento Theme
  • 5. • Skin – look and feel of a theme, colors & styles • Skin files – static, web-accessible Magento Skin
  • 6. • Skins are located separately from themes • Any skin can be chosen for any theme • Incompatible skin can be chosen for a theme “example” package “default” theme “mobile” theme “default” skin “modern” skin “simple” skin Magento 1.x Skin
  • 7. • Skin belongs to one theme only • Skin is located within a theme • Skin files web-access challenge “example” package “default” theme “mobile” theme “default” skin “modern” skin “simple” skin Magento 2 Skin
  • 8. • New skin for every locale • Inconsistent configuration: locale + localized skin “example” package “default” theme “default” skin “german” skin “french” skin Magento 1.x Skin Localization
  • 9. • Skin provides files for multiple locales • Consistent configuration: locale “example” package “default” theme “default” skin “de_DE” locale “fr_FR” locale Magento 2 Skin Localization
  • 10. Magento 2 View Layer Modularity
  • 11. Package Theme/Skin 1. <current> <current> 2. <current> <default> 3. <current> “default” 4. “base” “default” <xxx> – configured name “xxx” – exact name <current> package “base” package Magento 1.x View Layer Fallback <current> <default> “default” “default”
  • 12. • Contains pseudo-modular view files • app/design/frontend/base/default/… • catalog • checkout • cms • sales • … • Modules depend on “base/default” Module aliases Magento 1.x “base/default” Theme/Skin
  • 13. • app/code/<pool>/<Namespace>/<Module> • view • <area> • layout.xml • template.phtml • logo.png • style.css • Modules are independent of themes Modular View Files Skin files Theme files
  • 14. • Referring modular file <Namespace>_<Module>::file.ext • Omit module scope • If template used solely within its own module • In module’s configuration file* • In module’s layout update file* • In module’s CSS file* * - not implemented yet Module Scope
  • 15. Package Theme 1. <current> <current> 2. <current> <default> 2. <current> “default” 3. “base” “default” 3. Module theme files <xxx> – configured name “xxx” – exact name <current> package Module files Theme Files Fallback <current> theme “default” theme
  • 16. JavaScript lib Module files Theme Skin 1. <current> <current> 2. <current> “default” 3. “default” <current> 4. “default” “default” 5. Module skin files 6. JavaScript libraries <current> package <current> theme “default” theme Skin Files Fallback <current> skin “default” skin <current> skin “default” skin
  • 17. • Single interface for skin and JS lib files • Simplified HTML <head> tag manipulation • Skin can override JS lib files • Skin may require specific version of JS lib JavaScript Libraries Fallback
  • 18. • Need web-access • Modular skin files • app/code/<pool>/<Namespace>/<Module>/view • Skins • app/design/<area>/<package>/<theme>/skin/<skin> • Publication – copying to web-accessible location Skin Files Web-Access
  • 19. • Need processing • Relative URLs • URLs with module scope • Don’t need processing • Absolute URLs CSS Files Processing
  • 21. Container vs Block • Block – unit of a page output • Container – unit of a page structure • Container consists of • Blocks • Containers • Container renders all children
  • 22. Containers in Layout Updates <container> directive attributes: • name – unique name • label – human-readable label • html{Tag,Id,Class} – HTML tag name & attributes <?xml version="1.0"?> <layout version="2.0"> <example_handle> <container name="root_container" label="Root Container" htmlTag="div"> <block type="Mage_Core_Block_Template" name="block1" template="1.phtml"/> <container name="nested_container" label="Nested Container"/> </container>
  • 24. Magento 1.x Page Rendering • Layout handle – instructions of visual elements positioning and properties • Controller uses arbitrary layout handles
  • 25. Page Types • Page types – special layout handles • Controller uses one page type only • Page type may inherit a page type • Inherited page types are loaded implicitly
  • 26. Page Types in Layout Updates Layout handle attributes: • type="page" – distinguish page type • parent – ancestor page type <?xml version="1.0"?> <layout version="2.0"> <default type="page"> <block type="Mage_Core_Block_Template" name="block1" template="1.phtml"/> </default> <example_handle type="page" parent="default"> <block type="Mage_Core_Block_Template" name="block2" template="2.phtml"/> </example_handle>
  • 27. Containers & Page Types Usage The Visual Design Editor Page type breadcrumbs Container with the block Block drag & drop
  • 28. Summary • Magento 2 Features • Skin files relocation & localization • Modular view files • Containers • Page types • Links https://github.com/magento/magento2 https://wiki.magento.com/display/MAGE2DOC https://wiki.magento.com/display/MAGE2PROJECT
  • 29. Thank You! Q & A Sergey Shymko sergey.shymko@magento.com

Editor's Notes

  1. Design package (instance) – group of themes/skins
  2. Multiple skins may exists for a theme
  3. Same skin can be used for multiple themes. However, It’s practically impossible to create skin compatible with multiple themes.
  4. Text in images, JavaScript, etc.
  5. Better skin files reuse
  6. Workaround for absence of true view modularity
  7. View files are divided by areas Theme & skin files reside together Theme/skin files distinguished by extension Theme/skin can refer to module’s files Module cannot refer to theme/skin
  8. Skin file lookup is performed within the <current> package only
  9. There can be different ways to provide web access. We’ve chosen the publication. Algorithms With files duplication – faster, more storage space Without files duplication – slower, less storage space
  10. CSS publication requires algorithm “with files duplication”
  11. Blocks don’t guarantee children rendering, it’s up to template. Converted to containers Mage_Core_Block_Text_List Mage_Page_Block_Html_Wrapper
  12. Used layout handle not always corresponds to action name Any combination of layout handles can be used No way to determine actual number of pages a website has
  13. Page type breadcrumbs & navigation Drag-n-drop of blocks & containers