SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie Intro to TAL

Ähnlich wie 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)
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 

Kürzlich hochgeladen (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

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