O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mastering TypoScript: TYPO3 Website, Template, and Extension Development

Book Description

A complete guide to understanding and using TypoScript, TYPO3's powerful configuration language.

About This Book

  • Powerful control and customization using TypoScript
  • Covers templates, extensions, admin, interface, menus, and database control
  • You don't need to be an experienced PHP developer to use the power of TypoScript

Who this book is for

This book is suitable for TYPO3 developers, administrators, and designers who want to develop fully featured TYPO3 websites using the power of TypoScript. A basic knowledge of TYPO3 is expected, and PHP and MySQL programming experience is useful, though not essential for using this book.

What You Will Learn

  • Design and develop templates in TYPO3—design templates, pure TypoScript templates, and TemplaVoila
  • Develop extensions in TYPO3; build extensions using Kickstarter
  • Understand the objects, properties, operators, and data types in TypoScript
  • Use and customize different text editors like HTMLAreaRTE and Rich-Text-Editor
  • Understand the entire TYPO3 back end, including the Info/Modify tool, the Object browser, the Template Analyzer, and the TypoScript Properties display
  • Edit the front end using the Admin panel
  • Work with design templates using markers, subparts, and HTML comments
  • Understand how to present different views of content with different menu entry types
  • Understand TYPO3 database structure and query it using SQL
  • Use user groups to distribute the editing and management of content on your site
  • Customize the back end with Page TSConfig and User TSConfig

In Detail

Free, open-source, flexible, and scalable, TYPO3 is one of the most powerful PHP content management systems. It is well suited for creating intranets and extranets for the enterprise. While providing an easy-to-use web interface for non-technical authors and editors of content, its messaging and workflow system enable shared authoring and collaboration. TYPO3 provides flexible and powerful interfaces for both content editors and administrators, giving them full control of the core aspects the system. However for developers who need to customize the system, TYPO3 offers a powerful configuration language called TypoScript. Good knowledge of TypoScript is really a prerequisite for implementing complex applications with TYPO3 and gives developers full control over the configuration of TYPO3 and its template engine. TypoScript enables the complete output template to be created and manipulated, giving you full control over the layout of the site.

TypoScript also allows you to integrate dynamic contents, JavaScript-based menus, Flash, Graphics, etc. with ease. You have maximum control over the design of the website and can control all options that would otherwise be addressed by HTML simple text output, formatting, and much more. TypoScript also allows you to generate graphics at run time and display different content dynamically.

TypoScript is a declarative programming language that offers developers, administrators, and designers full control over the configuration of TYPO3 and its template engine. Only with a good command of TypoScript can you leverage the powerful capabilities of the TYPO3 engine, to customize and control all aspects of your TYPO3 sites. If you're serious about TYPO3 as your content platform, you need to master TypoScript.

Style and approach

Written in a clear, easy-to-read style, the book provides step-by-step instructions on using TypoScript for TYPO3 website development, template and extension development, and back-end and front-end administration. Each topic is tackled in a clear and practical way with many examples to develop your skills.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Table of Contents

  1. Mastering TypoScript: TYPO3 Website, Template, and Extension Development
    1. Mastering TypoScript: TYPO3 Website, Template, and Extension Development
    2. Credits
    3. About the Author
    4. Preface
      1. What This Book Covers
      2. Who This is Book For
      3. Conventions
      4. Reader Feedback
      5. Customer Support
        1. Downloading the Example Code for the Book
        2. Errata
        3. Questions
    5. 1. Introduction to TypoScript
      1. Prerequisites
        1. Dummy Package
        2. Setting up an Example Page Structure
      2. Declarative Programming with TypoScript
      3. The Power of TypoScript
      4. What is TypoScript?
      5. Back-end Configuration with TypoScript
      6. TypoScript and PHP
      7. TypoScript Templates
      8. Summary
    6. 2. Getting to Know TypoScript
      1. Hello World!
        1. Creating a Template
        2. Syntax
      2. Objects and Properties
        1. Copying Objects and Properties
        2. Referencing Objects
        3. Classic Sources of Errors
        4. The Classification of Objects
        5. Constants
      3. Operators
        1. Value Assignment
        2. Value Assignment over Several Lines
        3. The Copy and Delete Operators
        4. Referencing
        5. Conditions
        6. Faster Writing Through {}
      4. Datatypes
        1. Simple Datatypes
        2. Objects as Datatypes
        3. Functions as Datatypes
        4. The Wrap Principle
        5. Comments
        6. Conditions
        7. The ELSE Condition
        8. Extended Options
        9. Defining Your Own Conditions
        10. Functions
      5. Working with TSref
        1. Datatypes
        2. Objects and Properties
        3. Conditions
        4. Functions
        5. Constants
        6. Setup
        7. cObjects
        8. GIFBuilder
        9. MENU Objects
        10. Media/Scripts Plug-Ins
        11. Standard Templates
        12. PHP Include Scripts
        13. Casestory
        14. Index.php
        15. Tips
      6. Summary
    7. 3. Tools and Editors
      1. Choosing an Editor
        1. Syntax Highlighting in UltraEdit
      2. The Info/Modify Tool
        1. Elements
          1. Title
          2. Sitetitle
          3. Description
          4. Resources
          5. Constants
          6. Setup
          7. Editing the Whole Template
      3. The Object Browser
      4. The Template Analyzer
      5. The TypoScript Properties Display
      6. The Admin Panel
        1. Categories
          1. Preview
          2. Cache
          3. Publish
          4. Editing
          5. TypoScript
      7. The Constant Editor
        1. Preparing Constants
        2. A Practical Demonstration: Defining Heading Colors through Constants
        3. Categories
        4. Subcategories
        5. Field Types
        6. Describing Categories
      8. TypoScript in HomeSite
      9. HTMLArea RTE
        1. Using Your Own CSS Styles
        2. Activating and Deactivating Buttons
        3. Setting the Permitted Tags
        4. Customizing the Color Field
        5. Making Additional Functions Available
      10. Customizing the Rich-Text Editor (RTE)
        1. Configuring the Toolbar
        2. Defining Your Own Classes
        3. Paragraph Formats
        4. Defining Colors
        5. User-Defined Menus
        6. Modifying the Background Color
        7. Managing the Output
          1. Preserving <br /> Tags
          2. Allowing Additional Tags
      11. Summary
    8. 4. Design Templates
      1. Design Templates versus Templates
      2. Principles of Design Templates
        1. Markers
        2. Subparts
        3. HTML Comments and Subparts
      3. Double Headings
      4. Summary
    9. 5. Templates
      1. The Concept of Templates
        1. Hello World!
        2. Hello World! Part II
        3. Inheriting Templates
      2. Template Elements
      3. Objects and Properties of Websites
        1. Defining Page Properties with TypoScript
          1. bodyTag
          2. stylesheet
          3. meta
      4. Integrating Design Templates
        1. Activating the Design Template
        2. Activating Placeholders
          1. Activating Subparts
          2. Integrating a Stylesheet
          3. Activating Markers
          4. Locating Errors
      5. The Auto Parser Template
        1. Installing the Parser
          1. Creating a Sample Application
          2. Editing the Settings
      6. Standard Templates
        1. template
        2. temp.*
        3. styles
        4. records (example)
        5. content (default)
        6. frameset
        7. plugin
      7. Pure TypoScript Templates
      8. TemplaVoilà
        1. System Prerequisites
        2. Preparing TemplaVoilà
        3. Setting up the Data Structure
        4. Creating Content
        5. Conclusion
        6. Flexforms
      9. Summary
    10. 6. Working with Graphics
      1. Prerequisites
      2. Embedding Graphics
      3. Modifying Graphics
        1. Changing the Graphic Size
      4. Creating Graphics Dynamically
        1. GIFBUILDER
        2. Levels
          1. Positioning Levels
        3. Drawing Boxes
        4. Graphical Text
        5. Anti-Aliasing with niceText
      5. Advanced Options
        1. Shadows
        2. Relief
        3. Showing the Page Title as a Graphic
        4. Importing Graphics from the Database
      6. Caching
        1. What is Cached in TYPO3
        2. Emptying the Cache
      7. Summary
    11. 7. Menus
      1. Available Menu Types
      2. Hello Menu!
      3. Specifying Menu Properties
        1. Defining States
        2. Defining the Starting Point of a Menu
        3. Specifying Menu Types
        4. Defining the Entry Level
        5. Specifying the First Menu Entry
        6. Specifying the Number of Menu Entries
        7. Excluding Menu Items
      4. Text Menus
        1. Properties of Text Menus
        2. Defining Sub-Menus
        3. Using Stylesheets
        4. Spacing between the Menu Items
        5. OptionSplit: Adding Vertical Lines
        6. Menus and Tables
        7. Text Menus and JavaScript
      5. JavaScript Menus
        1. Calling Pages from the Menu
      6. Graphical Menus
        1. Creating Menu Items
        2. Integrating Sub-Menu Items
        3. Creating Lines
        4. Automatically Customizing the Menu Width
        5. Adding Background Graphics
        6. An Alternative to GMENU
      7. GMENU_FOLDOUT
      8. Layer Menus
        1. Formatting the Menu
        2. Text Menus in Layer Form
      9. ImageMaps
      10. Special Menus
        1. Next Page (Browse Menu)
        2. You are Here (Rootline Menu)
        3. Keywords Menu
        4. Updated Pages
        5. Directory Menus
        6. List Menu
      11. Summary
    12. 8. Frames
      1. Hello Frames!
      2. Advantages and Disadvantages of Frames
      3. Creating Frames
        1. Rows
        2. Columns
        3. Nesting Frames
        4. Defining Frame Properties
        5. Frames without Borders
        6. An Elegant Solution for Using Frames
      4. Iframes
        1. Installing the Extension
        2. Defining the Properties of Iframe
      5. Summary
    13. 9. Forms
      1. Building Forms
        1. Mandatory Fields
        2. The Forms Wizard
      2. Designing Fields
        1. A Completed Form
        2. Masking out Pre-Initialized Values
        3. Displaying Form Elements in Columns
      3. Setting up a Password-Protected Area
        1. Installing the System Folder
        2. Setting up User Groups
        3. Defining Access Restrictions
        4. Setting up the Login Form
        5. Refining the Login Form
        6. User Registration
      4. MailformPlus
      5. Standard Search
        1. Customizing the Search
        2. Customizing and Deleting the Selection Field
        3. Specifying the Target Window
        4. Defining Your Own Error Messages
        5. Formatting the Output
      6. Integrating the Extended Search
        1. Linking the Form
        2. Configuring the Search
        3. Improving the Display
        4. Selective Indexing
          1. Problems with Multilingual Websites
          2. Searching on Every Page
      7. Uploading Files
      8. Summary
    14. 10. TypoScript and SQL
      1. The Database Structure
      2. Reading Database Contents Dynamically
        1. Checking for Empty Fields
      3. Manipulating SQL Statements
        1. Arranging Content
        2. Selecting Specific Columns
        3. Formatting Elements in Specific Columns
      4. SQL Queries
        1. Constructing an Extension with Kickstarter
        2. Plugin Preview
        3. Creating a New Record
        4. Inserting SQL Queries
      5. Summary
    15. 11. Extensions
      1. Building Extensions
      2. Extension Categories
      3. The Extension Manager
        1. Installing Extensions
      4. Useful Extensions
        1. News
        2. Calendar Editor
          1. Customizing the Output
        3. Newsletter
          1. Creating a Registration Form
          2. Unsubscribing from the Newsletter
        4. Integrating a Chat Room
      5. Developing Your Own Extensions
        1. The Kickstarter Extension
          1. Setting up an Extension Key
          2. The Kickstarter Component
          3. Integrating the Front-End Plugin
        2. Extension Structure
        3. Functions of the Extension Manager
        4. TER Account
          1. Administering Extensions in TER
          2. Offering Documentation
        5. Designing your own Extension
      6. Practical Extension Development
        1. Coding Guidelines
          1. File Naming
          2. Classes
          3. Functions
          4. Headers and Copyright Notice
          5. Line Formatting
          6. Source Code Documentation
          7. Variables and Constants
        2. Database Abstraction
          1. The Wrapper Class
          2. Building Queries
          3. Query Execution Functions
          4. Database Abstraction in Real Life
        3. Security
          1. Cross-Site Scripting
          2. Manipulating SQL Queries
      7. Extending the References Extension
        1. Addressing Subparts
        2. Replacing Markers
      8. Summary
    16. 12. Barrier Freedom
      1. Resources in TYPO3
        1. CSS Styled Content
        2. Accessible Content
        3. CSS Styled Imagetext
        4. Accessible XHTML Template
        5. Acronym Manager
        6. Accessible Tables
        7. Gov Textmenu and Gov Accesskey
          1. Defining Accesskeys
      2. Creating Barrier-Free TYPO3 Content Elements
        1. Tables
          1. Extended Table Backend
          2. Accessible Tables
          3. KB Content Table
        2. Forms
        3. Menus and Barrier Freedom
          1. Text Menus
          2. Graphical Menus
        4. Dynamically Changeable Font Sizes
      3. Summary
    17. 13. Fine Tuning
      1. TypoScript and Multilingualism
        1. The Multiple-Tree Concept
        2. The One-Tree-Fits-All-Languages Concept
        3. Automatic Selection of Languages
        4. Menus and Multilingualism
      2. Publishing Multiple Versions
        1. Offering a PDF Version
          1. Installing HTMLDoc under Linux
          2. Making HTMLDoc Available for TYPO3
        2. Offering a Print Version
      3. Deactivating "Page is being generated"
      4. TYPO3 and Search Engines
        1. Inserting Meta Tags
        2. Simulating Static Documents
        3. RealURL
        4. Protection from Email Spam
        5. Customizing the Page Header
      5. Summary
    18. 14. Customizing the Back End with TSConfig
      1. Page TSConfig
        1. Configuring Back-End Modules
        2. Customizing Editing Forms with TCEFORM
        3. Configuring System Tables with TCEMAIN
      2. User TSConfig
        1. Setup
        2. admPanel
        3. options
      3. Summary
    19. A. TypoScript Reference
      1. Functions
        1. Date and Time Functions
          1. date
          2. strftime
        2. if
          1. directReturn
          2. equals
          3. isFalse
          4. isGreaterThan
          5. isLessThan
          6. isInList
          7. isPositive
          8. isTrue
          9. negate
          10. value
        3. imageLinkWrap
          1. bodyTag
          2. effect
          3. enable
          4. height
          5. JSWindow
          6. JSWindow.altURL
          7. JSWindow.expand
          8. JSWindow.newWindow
          9. target
          10. title
          11. width
          12. wrap
        4. parseFunc
          1. allowTags
          2. constants
          3. denyTags
          4. makelinks
          5. short
          6. tags
        5. select
          1. andWhere
          2. begin
          3. join, leftjoin, rightjoin
          4. languageField
          5. max
          6. orderBy
          7. pidInList
          8. selectFields
          9. uidInList
          10. where
        6. tableStyle
          1. align
          2. border
          3. cellspacing
          4. cellpadding
          5. params
      2. Conditions
        1. Browsers
        2. Browser-Version
        3. Operating System
        4. Device
        5. Language
        6. Other Options
      3. Forms
        1. Form fields
          1. badMess
          2. goodMess
          3. layout
          4. target
          5. redirect
          6. recipient
      4. Frames
        1. Frame
          1. name
          2. obj
          3. options
          4. params
          5. src
        2. Frameset
          1. 1,2,3,4
          2. cols
          3. rows
          4. params
        3. GIFBUILDER
          1. backColor
          2. format
          3. xy
          4. reduceColor
          5. transparentBackground
          6. transparentColor
          7. quality
          8. offset
          9. maxWidth
          10. maxHeight
          11. workArea
        4. Menus
          1. Menu states
          2. General Properties
      5. Object Reference
        1. CONTENT
          1. select
          2. table
        2. EDITPANEL
          1. allow
          2. label
          3. line
          4. newRecordFromTable
          5. onlyCurrentPid
          6. previewBorder
        3. FILE
          1. altText, titleText
          2. file
          3. longdescUrl
        4. HRULER
        5. IMAGE
          1. altText, titleText
          2. border
          3. file
          4. longdescURL
          5. params
        6. CLEARGIF
          1. Height
          2. width
        7. IMAGE_RESOURCE
          1. file
        8. PAGE
          1. 1, 2, 3, 4...
          2. bgImg
          3. bodyTag
          4. bodyTagAdd
          5. bodyTagMargins
          6. config
          7. headerData
          8. includeLibs
          9. meta
          10. shortcutIcon
          11. typeNum
        9. PAGE and Stylesheet Specifications
          1. admPanelStyles
          2. CSS_inlineStyle
          3. hover
          4. hoverStyle
          5. includeCSS.[array]
          6. insertClassesFromRTE
          7. noLinkUnderline
          8. smallFormField
          9. stylesheet
        10. TEMPLATE
          1. markerWrap
          2. marks
          3. subparts
          4. template
          5. workOnSubpart
        11. CONFIG
          1. admPanel
          2. cache_periode
          3. headerComment
          4. includeLibrary
          5. index_enable
          6. index_externals
          7. local_all
          8. message_preview
          9. no_cache
          10. notification_email_urlmode
          11. simulateStaticDocuments
          12. simulateStaticDocuments_addTitle
          13. simulateStaticDocuments_noTypelfNoTitle
          14. simulateStaticDocuments_pENC
          15. simulateStatic Documents_dont RedirectPathInfoError
          16. spamProtectEmailAddresses
          17. spamProtectEmailAddresses_atSubst
          18. stat
          19. stat_excludeBEuserHits
          20. stat_excludeIPList
          21. stat_mysql
          22. stat_apache
          23. stat_apache_logfile
          24. sys_language_uid
          25. titleTagFunction
      6. Summary