• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 38. Developing New TALES Expressions > An Overview of TALES Expressions

An Overview of TALES Expressions

Next, let's take a closer look at the expression component itself. A TALES expression is actually a very simple object, which only has a constructor and a call method:

  • The constructor takes three arguments: name, expr, and engine. The name argument is actually not used and can simply be ignored. The expr argument contains the string that is being evaluated; it contains basically the user's source code. The engine argument is an instance of the ExpressionEngine component, which manages all the different expressions.

  • The __call__() method takes only one argument: econtext. The expression context provides expression-external runtime information, such as declared variables. This allows the expression to behave differently in different contexts and to accept custom user input. It is the responsibility of the using code, such as TAL, to provide and manage the context-sensitive variables.

    This method should return any value that would be expected. For the path expression, it is an object that was located, and for the string expression it would be a string. It is up to the user's code to deal with the output correctly.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint