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

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Último (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

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