Appearance
Template Tags
Freebie Segment Tags
Inside a template, you can access the original, un-effed-with URL segments using {freebie_1}
, {freebie_2}
, etc. These will return the segments you see in your browser’s location bar — however, if you use {segment_1}
instead, you’ll get back the segments EE is actually parsing. For example, if you set “preview” and “comments” as Freebie segments, and visit…
/blog/preview/my-favorite-post/comments/
…your template vars will return the following:
{segment_1}
== blog{segment_2}
== my-favorite-post{freebie_1}
== blog{freebie_2}
== preview{freebie_3}
== my-favorite-post{freebie_4}
== comments{freebie_original_uri}
== /blog/preview/my-favorite-post/comments/{freebie_final_uri}
== /blog/my-favorite-post/
Freebie:any
Use {exp:freebie:any name="segment_name"}
to see if any segment matches the “name” string. Example:
/blog/preview/my-favorite-post/comments/
{exp:freebie:any name="blog"} == "true"
{if "{exp:freebie:any name="comments"}" == "true"}<h2>Show comments</h2>{/if}
Freebie:is_number
Use {exp:freebie:is_number segment="3"}
to see if a segment is numeric or not. This is useful when you’re ignoring numeric segments, but want to test for their presence.
Freebie:category_id, _name, _description, _image
Use {exp:freebie:category_id segment="3"}
to get the category_id of a segment. Useful in a number of ways. {exp:freebie:category_name segment="3"}
will return the name of the category, and similar requests for category_description and category_image will do the same.
If you want to specify a group and/or site ID to pull the category from, use the following syntax: {exp:freebie:category_id segment=“3” group_id=“2” site_id="1"}
To get the category ID for a channel:entries tag, make sure to parse inward and use single quotes for the freebie arguments. Example:
{exp:channel:entries channel="news" category="{exp:freebie:category_id segment='2'}" parse="inward"}
A few more
{freebie_last}
will get you the last segment from the original URI.
{freebie_break_1}
, {freebie_break_2}
, etc will return the segments after a break segment.