The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.
This plugin enables searching for certain string in URL segments.
PARAMETERS
1) segment - required. Allows to specify URL segment in which certain string should be looked for. Possible values: 1, 2, 3, … 9. You can use pipe operator to stack several URL segments, e.g. segment=”3|4”
2) string - required. Allows to specify the string which should be looked for in URL. You can use pipe operator to stack several strings, e.g. string=”article|news”
3) string_pos - optional. Allows to specify position in URL segment at which string should be present. Possible values - any positive integer starting from zero or “any”. Default value is “any”.
4) exact_match - optional. Allows to specify if string and URL segment should match exactly. Possible values - “yes” and “no”. Default value is “no”.
5) on_true - optional. Allows to specify what the variable {string_in_url} should output in case string was found in specified URL segment(s). Possible values - “segment”, “string” or any custom string. If the value of this parameter is “segment”, then URL segment in which string was found will be outputted; if the value of this parameter is “string”, then the value of “string” parameter will be outputted; if the value of this parameter is some custom string, then that string will be outputted. In case you need to output empty string the leave this parameter undefined.
6) on_false - optional. Allows to specify what the variable {string_in_url} should output in case string was not found in specified URL segment(s). Possible values - “segment”, “string” or any custom string. If the value of this parameter is “segment”, then URL segment in which string was looked for will be outputted; if the value of this parameter is “string”, then the value of “string” parameter will be outputted; if the value of this parameter is some custom string, then that string will be outputted. In case you need to output empty string the leave this parameter undefined.
VARIABLES
1) string_in_url - outputs the value of “on_true” parameter if the string was found in specified URL segment(s) or the value of “on_false” parameter if the string was not found.
USAGE
The code
{exp:string_in_url segment="4" string="comment_" string_pos="0" on_true="string_found" on_false="string_not_found"}
{string_in_url}
{/exp:string_in_url}will output the string “string_found” in case string “comment_” is present at the start of the segment_4, and will output the string “string_not_found” in case string “comment_” is not present at the start of the segment_4.
String in URL2 is a clone of String in URL plugin. You can use it in cases when there is a need to nest exp:string_in_url tags:
{exp:string_in_url segment="4" string="comment_" string_pos="0" on_true="string_found" on_false="string_not_found"}
{exp:string_in_url2 segment="3" string="article" string_pos="0" on_true="string2_found" on_false="string2_not_found"}
{string_in_url}
{string_in_url2}
{/exp:string_in_url2}
{/exp:string_in_url}Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.