Subsegment

Developer

Laisvunas

3rd Party (Commercial)


EE Version Support

  • ExpressionEngine 1.x
  • ExpressionEngine 2

Compatibility

If an item is crossed out, it might be untested, not applicable or incompatible. Contact the developer to be sure.

  • Updater
  • Multi Site Manager
  • Stand Alone Entry Form
  • Low Variables
  • Content Elements
  • Better Workflow
  • Matrix
  • Grid
  • Webservice
  • Publisher

Requirements

  • jQuery for the Control Panel

Add-On Type(s)

Plugin

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 created June 5, 2009, 2:36 pm.
This entry was last updated May 26, 2011, 3: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!

Returns: devot:ee has a 30-day return policy on all commercial add-ons sold through devot-ee.com. If you need to return an add-on, do not go to the developer or the developer's site, but rather visit our returns page at https://devot-ee.com/returns to initiate your return. If you have questions, email support@devot-ee.com.

There are no reviews for this add-on yet.

What are you waiting for? Rate it and review it!