EE 1
EE 2
Subsegment
Developer
3rd Party (Commercial)
Current Version: 1.5
Buy Now!
Compatibility
- LG Addon Updater
- Multi Site Manager
- Stand Alone Entry Form
Requirements
- jQuery for the Control Panel
Tags
Subsegment allows to split url segment into a subsegments array and find any subsegment.
PARAMETERS:
1) segment - (integer from 1 to 9). Required. Allows you to specify which url segment will
be parsed. Numbering of segments is the same as in ExpressionEngine’s url segment variables.
2) separator - (any string which consists from characters legal for use in url segment). Required.
Allows you to specify the string according to which url segment will be split into array of subsegments.
3) on_failure - (‘segment’ or any string which consists from characters legal for use
in ExpressionEngine’s tag parameter values). Optional. Allows you to specify what variables of
{exp:subsegment} tag will output in case needed subsegment was not found.
EXAMPLE OF USAGE:
If segment_3 is
/project_5-article_7-section_6/
then you can use {subsegment_0}, {subsegment_1} etc. variable within
{exp:subsegment}{/exp:subsegment} tag pair
{exp:subsegment segment="3" separator="-"}
{subsegment_1}
{/exp:subsegment}
It will return “article_7”.
Variables {subsegment_0}-{subsegment_8}
within {exp:subsegment}{/exp:subsegment} tag pair can be used
as parameter of other tag. For such use
you must add parse=“inward” parameter to {exp:subsegment} tag.
For example, code as this will work
{exp:subsegment segment="3" separator="-" parse="inward"}
{exp:weblog:entries weblog="my_weblog" url_title="{subsegment_1}"}
Some code
{/exp:weblog:entries}
{/exp:subsegment}
If subsegment does not exist then the tag by default will return nothing.
In case ‘on_failure’ parameter was defined, then, if subsegment does not exist,
the tag will output what was specified as value of this parameter.
If ‘segment’ is the value of ‘on_failure’ parameter, then the tag will output
segment, if segment exists. If ‘on_failure’ parameter has some other string as
its value, then that string will be outputted.
Conditionals are supported. The value of “on_failure” parameter has no effect
on the values of variables {subsegment_0}-{subsegment_8} inside conditionals.
E.g. if the value of “on_failure” parameter is “AAA” and the third subsegment
does not exist, then the variable {subsegment_2} will output “AAA” outside conditionals
and empty string inside conditionals.
Subsegment Links
This entry was last updated May 26, 2011, 2:08 am.
Disclaimer: Information about ExpressionEngine add-ons is provided as a service to you, the user, and every member of the ExpressionEngine community. Devot:ee is not responsible if you hose, mangle, wreck, or otherwise destroy your EE website by installing an add-on that you found out about at this site, regardless of its rating, Favorites status, commercial or free status, or general popularity. Caveat EEmptor!
There are no reviews for this add-on yet.
What are you waiting for? Rate it and review it!