b:eval Tag - Blogger Tags References

The Expression Evaluation Tag or <b:eval> is a singleton tag that allows you to explicitly display the value of the result of a Blogger expression.


It is only used when you want to use expressions in your blogger XML code.

Characteristics or Expression Evaluation Tag:


  1. It can not nest.
  2. Works in all of the XML, except in <b:skin> tag.

The syntax for b:eval Tag:

<b:eval expr='EXPRESSION'/>
EXPRESSION: is the expression that we want to evaluate.

Attributes Used for <b:eval> Tag:

There are several attributes that can be used for this tag that are listed under.
AttributeDescriptionStrictness
exprThe expected value can be an explicit value, a data item or a Blogger expression.Mandatory

Examples for b:eval Tag:

To Get Data From table by Index.

<b:eval expr='data:posts[0].labels[5].name'/>
The result of the expression is the 6th wording of the 1st article
To be able to use the index in data, it is necessary to check that the set exists by using conditions. If the set does not exist, the inclusion containing the expression will not be executed.

Evaluating Mathematical Operation:

<b:eval expr='(data:posts.length * 10) / 2'/>
The result of the expression is the number of articles contained on the current page, multiplied by 10, divided by 2.

Evaluation using the Ternary Operator:

<b:eval expr='data:blog.pageName ? "Page Name Is " + data:blog.pageName : "Page Name Not Available."'/>
The result of the expression is one of two specified values.

  • If true: "Page Name Is NAME OF THE PAGE "
  • If false: "Page Name Not Available"

Evaluation using the Lambda Operator:

<b:eval expr='data:posts count (p => p.enclosures any (e => e.mimeType == "image/jpeg"))'/>
The result of the expression is the number of articles containing an attachment with the type/mime image/jpeg.

Conclusion:

That's all about Blogger Expression Evaluation Tag. To use this tag you should have a concept about different operators eg: ternary and lambda.

إرسال تعليق

Post a Comment (0)

أحدث أقدم