SlideShare una empresa de Scribd logo
1 de 23
Descargar para leer sin conexión
PLONE SYMPOSIUM EAST 2011




Intro to TAL
Chrissy Wainwright
What is TAL?
                                      PLONE SYMPOSIUM EAST 2011




* Zope Templating Language
* Allow for dynamic content in HTML
* Does not render in the site
TAL Syntax
                                          PLONE SYMPOSIUM EAST 2011




<div tal:content=”context/Title”></div>

<tal:title content=”context/Title” />

Use an HTML tag or <tal:whatever...
TAL Syntax
                                          PLONE SYMPOSIUM EAST 2011




<a tal:attributes=”href url;
                   class linkClass”>


* separate multiple declarations with a semicolon
* align variables/attributes on the left
TAL Syntax
                                             PLONE SYMPOSIUM EAST 2011




<div tal:condition=”python:phone and fax”>


Python expressions allow us to put Python code
directly in the template. This is not meant for
long, complex expressions.
TAL Syntax
                                           PLONE SYMPOSIUM EAST 2011




<a tal:attributes=
  ”href string:${item/url}/folder”>

With string expressions, we can add static text to
dynamic content or combine multiple variables
TAL Commands
                    PLONE SYMPOSIUM EAST 2011




* define
* condition
* repeat
* content/replace
* attributes
* omit-tag
tal:define
                                          PLONE SYMPOSIUM EAST 2011




* defines variables

<div id=”portal-breadcrumbs”
     tal:define=”breadcrumbs view/breadcrumbs”>
tal:condition
                            PLONE SYMPOSIUM EAST 2011




* evaluates an expression
* display element if True
* omit element if False
tal:condition
                                          PLONE SYMPOSIUM EAST 2011




<tal:item define=”is_last repeat/crumb/end”>
  <span tal:condition=”not: is_last”>
    This
  </span>
  <span tal:condition=”is_last”>
    That
  </span>
</tal:item>
tal:repeat
                                   PLONE SYMPOSIUM EAST 2011




* repeats over a set of elements
* available variables:
 * index / number
 * even / odd
 * start / end
 * length
tal:repeat
                                          PLONE SYMPOSIUM EAST 2011




<span tal:repeat=”crumb breadcrumbs”>
  <a tal:attributes=”href crumb/absolute_url”
     tal:content=”crumb/Title”>crumb</a>
</span>
tal:content
                                             PLONE SYMPOSIUM EAST 2011




* determines what content will display inside a
  tag
* any content inside the tag in the template will
  not display in the site

<span tal:content=”title”>The Title</span>
tal:content
                                          PLONE SYMPOSIUM EAST 2011




use ‘structure’ for content with HTML code,
so the code is not rendered as text

<tal:body content=”structure context/getText” />
tal:replace
                                             PLONE SYMPOSIUM EAST 2011




* determines what content will display in place
  of a tag
* the tag will not display in the site

<span tal:replace=”title”>The Title</span>
tal:replace
                                          PLONE SYMPOSIUM EAST 2011




* replacing an element with ‘nothing’ will not
  render in the site
* good for commenting out parts of the code

<div tal:replace=”nothing”>
  This is a comment
</div>
tal:attributes
                                           PLONE SYMPOSIUM EAST 2011




allows you to set a dynamic value to an attribute
(href, src, class, etc)

<a href=”#”
   tal:content=”crumb/Title”
   tal:attributes=”href crumb/absolute_url”></a>
tal:omit-tag
                                           PLONE SYMPOSIUM EAST 2011




* similar to condition, evaluates an expression
* if true, the wrapping tag is omitted, and only
  the content is displayed
* if false, the tag displays
* omit-tag=”” will also omit the tag
tal:omit-tag
                                         PLONE SYMPOSIUM EAST 2011




<a href=”#”
   tal:define=”url crumb/absolute_url”
   tal:omit-tag=”not:url”
   tal:attributes=”href url”>
Macros
                                         PLONE SYMPOSIUM EAST 2011




The Macro Expansion Template Attribute
Language (METAL) allows us to create macros
within our page templates, which saves us from
repeating code.


* define-macro / use-macro
* define-slot / fill-slot
Macros
                                          PLONE SYMPOSIUM EAST 2011




<div metal:define-macro=”footer”>
  &copy; 2011 Company Name
</div>

<metal:foot
  use-macro=”context/my_macros/macros/footer”>
</metal:foot>
Macro Slots
                                          PLONE SYMPOSIUM EAST 2011




<h1 metal:define-slot=”content-title”>
  <span tal:replace=”context/Title”></span>
</h1>

<h1 metal:fill-slot=”content-title”>
  Custom Title
</h1>
PLONE SYMPOSIUM EAST 2011




   eck out
Ch
             p. com/d emos
six feetu

Más contenido relacionado

La actualidad más candente

Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Gunjan Patel
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Peter Martin
 
Building YAP Applications with YUI
Building YAP Applications with YUIBuilding YAP Applications with YUI
Building YAP Applications with YUIReid Burke
 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress WayMatt Wiebe
 
State of play for Joomla - Nov 2014
State of play for Joomla - Nov 2014State of play for Joomla - Nov 2014
State of play for Joomla - Nov 2014Tim Plummer
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesAndy Wallace
 
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the BasicsUpgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the BasicsHeather Wozniak
 
Joomla! Day UK 2009 Menus Presentation
Joomla! Day UK 2009 Menus PresentationJoomla! Day UK 2009 Menus Presentation
Joomla! Day UK 2009 Menus PresentationAndy Wallace
 
WPtech: L'API Customizer pour les plugins
WPtech: L'API Customizer pour les pluginsWPtech: L'API Customizer pour les plugins
WPtech: L'API Customizer pour les pluginscorsonr
 

La actualidad más candente (9)

Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3Develop advance joomla! MVC Component for version 3
Develop advance joomla! MVC Component for version 3
 
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
Developing a Joomla 3.x Component using RAD FOF- Part 2: Front-end + demo - J...
 
Building YAP Applications with YUI
Building YAP Applications with YUIBuilding YAP Applications with YUI
Building YAP Applications with YUI
 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
 
State of play for Joomla - Nov 2014
State of play for Joomla - Nov 2014State of play for Joomla - Nov 2014
State of play for Joomla - Nov 2014
 
Joomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic TemplatesJoomla! Day UK 2009 Basic Templates
Joomla! Day UK 2009 Basic Templates
 
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the BasicsUpgrading a Plone 3 Theme for Plone 4: Beyond the Basics
Upgrading a Plone 3 Theme for Plone 4: Beyond the Basics
 
Joomla! Day UK 2009 Menus Presentation
Joomla! Day UK 2009 Menus PresentationJoomla! Day UK 2009 Menus Presentation
Joomla! Day UK 2009 Menus Presentation
 
WPtech: L'API Customizer pour les plugins
WPtech: L'API Customizer pour les pluginsWPtech: L'API Customizer pour les plugins
WPtech: L'API Customizer pour les plugins
 

Destacado

The Future of [Plone] Theming
The Future of [Plone] ThemingThe Future of [Plone] Theming
The Future of [Plone] Themingcdw9
 
Funnelweb ploneconf2010
Funnelweb ploneconf2010Funnelweb ploneconf2010
Funnelweb ploneconf2010Dylan Jay
 
Introduction to Python for Plone developers
Introduction to Python for Plone developersIntroduction to Python for Plone developers
Introduction to Python for Plone developersJim Roepcke
 
Unknown plone
Unknown ploneUnknown plone
Unknown plonecdw9
 
Anne’s photos
Anne’s photosAnne’s photos
Anne’s photosadaly2
 
Human papillomavirus hpv_ (1)
Human papillomavirus hpv_ (1)Human papillomavirus hpv_ (1)
Human papillomavirus hpv_ (1)HughMcCullough14
 
Welcome to my University of Oregon
Welcome to my University of OregonWelcome to my University of Oregon
Welcome to my University of OregonKDene
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...Dylan Jay
 
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionManaging Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionClayton Parker
 

Destacado (10)

The Future of [Plone] Theming
The Future of [Plone] ThemingThe Future of [Plone] Theming
The Future of [Plone] Theming
 
Funnelweb ploneconf2010
Funnelweb ploneconf2010Funnelweb ploneconf2010
Funnelweb ploneconf2010
 
Introduction to Python for Plone developers
Introduction to Python for Plone developersIntroduction to Python for Plone developers
Introduction to Python for Plone developers
 
Unknown plone
Unknown ploneUnknown plone
Unknown plone
 
Anne’s photos
Anne’s photosAnne’s photos
Anne’s photos
 
Human papillomavirus hpv_ (1)
Human papillomavirus hpv_ (1)Human papillomavirus hpv_ (1)
Human papillomavirus hpv_ (1)
 
Welcome to my University of Oregon
Welcome to my University of OregonWelcome to my University of Oregon
Welcome to my University of Oregon
 
Bcs
BcsBcs
Bcs
 
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...The eggless Plone manifesto (or Plone  the open source cms-as-a-service platf...
The eggless Plone manifesto (or Plone the open source cms-as-a-service platf...
 
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite SolutionManaging Chaos: Merging 120 Sites into a single Plone Multisite Solution
Managing Chaos: Merging 120 Sites into a single Plone Multisite Solution
 

Similar a Intro to TAL

Similar a Intro to TAL (20)

New Browsers
New BrowsersNew Browsers
New Browsers
 
Transforming Xml Data Into Html
Transforming Xml Data Into HtmlTransforming Xml Data Into Html
Transforming Xml Data Into Html
 
XML Bible
XML BibleXML Bible
XML Bible
 
XML Transformations With PHP
XML Transformations With PHPXML Transformations With PHP
XML Transformations With PHP
 
Php Mysql Feedrss
Php Mysql FeedrssPhp Mysql Feedrss
Php Mysql Feedrss
 
Rapid html & css coding with emmet
Rapid html & css coding with emmetRapid html & css coding with emmet
Rapid html & css coding with emmet
 
WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)WDIM268 Week 6 (Summer 2010)
WDIM268 Week 6 (Summer 2010)
 
Css, xhtml, javascript
Css, xhtml, javascriptCss, xhtml, javascript
Css, xhtml, javascript
 
PHPTAL introduction
PHPTAL introductionPHPTAL introduction
PHPTAL introduction
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
Optaros Surf Code Camp Lab 4
Optaros Surf Code Camp Lab 4Optaros Surf Code Camp Lab 4
Optaros Surf Code Camp Lab 4
 
XML and XSLT
XML and XSLTXML and XSLT
XML and XSLT
 
Xhtml Css Presentation
Xhtml Css PresentationXhtml Css Presentation
Xhtml Css Presentation
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile Widgets
 
Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1
 
Kick start @ html5
Kick start @ html5Kick start @ html5
Kick start @ html5
 
WEB TECHNOLOGIES XML
WEB TECHNOLOGIES XMLWEB TECHNOLOGIES XML
WEB TECHNOLOGIES XML
 
HTML literals, the JSX of the platform
HTML literals, the JSX of the platformHTML literals, the JSX of the platform
HTML literals, the JSX of the platform
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Google AMP (Accelerated Mobile Pages)
Google AMP (Accelerated Mobile Pages)Google AMP (Accelerated Mobile Pages)
Google AMP (Accelerated Mobile Pages)
 

Más de cdw9

Debugging Your Plone Site
Debugging Your Plone SiteDebugging Your Plone Site
Debugging Your Plone Sitecdw9
 
Crafting an Impactful Home Page That Your Editors Will Love
Crafting an Impactful Home Page That Your Editors Will LoveCrafting an Impactful Home Page That Your Editors Will Love
Crafting an Impactful Home Page That Your Editors Will Lovecdw9
 
Contributing to Open Source (Lightning Talk version)
Contributing to Open Source (Lightning Talk version)Contributing to Open Source (Lightning Talk version)
Contributing to Open Source (Lightning Talk version)cdw9
 
Debugging with PDB
Debugging with PDBDebugging with PDB
Debugging with PDBcdw9
 
Introduction to Transmogrifier
Introduction to TransmogrifierIntroduction to Transmogrifier
Introduction to Transmogrifiercdw9
 
Contributing to Open Source
Contributing to Open SourceContributing to Open Source
Contributing to Open Sourcecdw9
 
Making CSS and Firebug Your New Friends
Making CSS and Firebug Your New FriendsMaking CSS and Firebug Your New Friends
Making CSS and Firebug Your New Friendscdw9
 

Más de cdw9 (7)

Debugging Your Plone Site
Debugging Your Plone SiteDebugging Your Plone Site
Debugging Your Plone Site
 
Crafting an Impactful Home Page That Your Editors Will Love
Crafting an Impactful Home Page That Your Editors Will LoveCrafting an Impactful Home Page That Your Editors Will Love
Crafting an Impactful Home Page That Your Editors Will Love
 
Contributing to Open Source (Lightning Talk version)
Contributing to Open Source (Lightning Talk version)Contributing to Open Source (Lightning Talk version)
Contributing to Open Source (Lightning Talk version)
 
Debugging with PDB
Debugging with PDBDebugging with PDB
Debugging with PDB
 
Introduction to Transmogrifier
Introduction to TransmogrifierIntroduction to Transmogrifier
Introduction to Transmogrifier
 
Contributing to Open Source
Contributing to Open SourceContributing to Open Source
Contributing to Open Source
 
Making CSS and Firebug Your New Friends
Making CSS and Firebug Your New FriendsMaking CSS and Firebug Your New Friends
Making CSS and Firebug Your New Friends
 

Último

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Último (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

Intro to TAL

  • 1. PLONE SYMPOSIUM EAST 2011 Intro to TAL Chrissy Wainwright
  • 2. What is TAL? PLONE SYMPOSIUM EAST 2011 * Zope Templating Language * Allow for dynamic content in HTML * Does not render in the site
  • 3. TAL Syntax PLONE SYMPOSIUM EAST 2011 <div tal:content=”context/Title”></div> <tal:title content=”context/Title” /> Use an HTML tag or <tal:whatever...
  • 4. TAL Syntax PLONE SYMPOSIUM EAST 2011 <a tal:attributes=”href url; class linkClass”> * separate multiple declarations with a semicolon * align variables/attributes on the left
  • 5. TAL Syntax PLONE SYMPOSIUM EAST 2011 <div tal:condition=”python:phone and fax”> Python expressions allow us to put Python code directly in the template. This is not meant for long, complex expressions.
  • 6. TAL Syntax PLONE SYMPOSIUM EAST 2011 <a tal:attributes= ”href string:${item/url}/folder”> With string expressions, we can add static text to dynamic content or combine multiple variables
  • 7. TAL Commands PLONE SYMPOSIUM EAST 2011 * define * condition * repeat * content/replace * attributes * omit-tag
  • 8. tal:define PLONE SYMPOSIUM EAST 2011 * defines variables <div id=”portal-breadcrumbs” tal:define=”breadcrumbs view/breadcrumbs”>
  • 9. tal:condition PLONE SYMPOSIUM EAST 2011 * evaluates an expression * display element if True * omit element if False
  • 10. tal:condition PLONE SYMPOSIUM EAST 2011 <tal:item define=”is_last repeat/crumb/end”> <span tal:condition=”not: is_last”> This </span> <span tal:condition=”is_last”> That </span> </tal:item>
  • 11. tal:repeat PLONE SYMPOSIUM EAST 2011 * repeats over a set of elements * available variables: * index / number * even / odd * start / end * length
  • 12. tal:repeat PLONE SYMPOSIUM EAST 2011 <span tal:repeat=”crumb breadcrumbs”> <a tal:attributes=”href crumb/absolute_url” tal:content=”crumb/Title”>crumb</a> </span>
  • 13. tal:content PLONE SYMPOSIUM EAST 2011 * determines what content will display inside a tag * any content inside the tag in the template will not display in the site <span tal:content=”title”>The Title</span>
  • 14. tal:content PLONE SYMPOSIUM EAST 2011 use ‘structure’ for content with HTML code, so the code is not rendered as text <tal:body content=”structure context/getText” />
  • 15. tal:replace PLONE SYMPOSIUM EAST 2011 * determines what content will display in place of a tag * the tag will not display in the site <span tal:replace=”title”>The Title</span>
  • 16. tal:replace PLONE SYMPOSIUM EAST 2011 * replacing an element with ‘nothing’ will not render in the site * good for commenting out parts of the code <div tal:replace=”nothing”> This is a comment </div>
  • 17. tal:attributes PLONE SYMPOSIUM EAST 2011 allows you to set a dynamic value to an attribute (href, src, class, etc) <a href=”#” tal:content=”crumb/Title” tal:attributes=”href crumb/absolute_url”></a>
  • 18. tal:omit-tag PLONE SYMPOSIUM EAST 2011 * similar to condition, evaluates an expression * if true, the wrapping tag is omitted, and only the content is displayed * if false, the tag displays * omit-tag=”” will also omit the tag
  • 19. tal:omit-tag PLONE SYMPOSIUM EAST 2011 <a href=”#” tal:define=”url crumb/absolute_url” tal:omit-tag=”not:url” tal:attributes=”href url”>
  • 20. Macros PLONE SYMPOSIUM EAST 2011 The Macro Expansion Template Attribute Language (METAL) allows us to create macros within our page templates, which saves us from repeating code. * define-macro / use-macro * define-slot / fill-slot
  • 21. Macros PLONE SYMPOSIUM EAST 2011 <div metal:define-macro=”footer”> &copy; 2011 Company Name </div> <metal:foot use-macro=”context/my_macros/macros/footer”> </metal:foot>
  • 22. Macro Slots PLONE SYMPOSIUM EAST 2011 <h1 metal:define-slot=”content-title”> <span tal:replace=”context/Title”></span> </h1> <h1 metal:fill-slot=”content-title”> Custom Title </h1>
  • 23. PLONE SYMPOSIUM EAST 2011 eck out Ch p. com/d emos six feetu