URL Helper

Developer

Brian Litzinger

3rd Party (Free)

26 downloads (last 90 days)

Creative Commons Attribution

EE Version Support

  • ExpressionEngine 2
  • ExpressionEngine 3

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)

Extension

Tags

URL Helper is the combination of a couple of popular plugins/extensions, plus some extra goodness thrown in for good measure. It parses the URL and creates a slew of global variables to use in your templates.

Below is a list of variables it creates. There is also a prefix option in the extension settings, so you can create a prefix for all the variables, e.g. {url:referrer} instead of {referrer}. This started as a basic extension, and over the course of 2 years and 30+ EE sites it has grown a bit each time depending on what I needed. This also includes an old version of Low’s Seg2Cats extension, which works just as well as the new one, plus I added a couple of additional variables.

You may ask why the encoded URL options are available, but next time you need to pass a full URL as a query parameter in EE you’ll thank me (EE doesn’t like that).

Installation

Download the .zip from GitHub, extract the contents and rename the folder to url_helper and place it in your system/expressionengine/third_party folder, then go to Add-ons > Extensions in your control panel to enable it.

Variables

{last_segment} - returns the very last segment in the URI, even if it's a pagination segment
{last_segment_absolute} - returns the very last segment in the URI, but 2nd to last if the last is a pagination segment
{last_segment_id} - returns the ID of the last segment, in the case of /seg1/seg2/seg3/ it will return "3"
{last_segment_absolute_id} - return the ID of the last segment, or 2nd to last if the last is a pagination segment. In the case of /seg1/seg2/seg3/P5 it will return "3"
{parent_segment} - Will return the 2nd to last segment in the URI. In the case of /seg1/seg2/seg3/, it will return "seg2"
{all_segments} - /seg1/seg2/seg3/
{current_url} - http://www.mysite.com + segments + query string
{current_uri} - segments + query string
{current_url_encoded} - {current_url} base64encoded
{current_uri_encoded} - {current_uri} base64encoded
{query_string} - current query string including ?, returns blank if no query string exists
{referrer} - full referring/previous url visited
{referrer:segment_N} - fetch any segment from the referring url
{rev_segment_N} - segments reversed
{segment_N_category_id} 
{segment_N_category_name}
{segment_N_category_description}
{segment_N_category_image}
{last_segment_category_id}
{last_segment_category_name}
{last_segment_category_description}
{last_segment_category_image}
{segment_category_ids} - 2&6&9 - useful for doing an all inclusive search of the segments
{segment_category_ids_any} - 2|6|9 - useful for doing an all inclusive search of the segments

Provided by PHP's parse_url() method

{query} - current query string without ?
{scheme} - http, https, ftp etc
{host} - your domain name, e.g. localhost, site.com
{port} - any port number present in the URL, e.g. :80 or :8888
{path} - full folder/virtural folder path or all segments if your site is located at the root of the domain/vhost
{fragment} - anything after # in the URI
{user}
{pass}

URL Helper Links

Hooks Used

If the add-on is an extension, and ties into ExpressionEngine's core files, it will use ExpressionEngine hooks. We are listing any hooks the add-on uses for developers to have an easier time locating other add-ons that they can reference for their own work.

  1. sessions_end

This entry was created February 14, 2012, 12:04 pm.
This entry was last updated June 12, 2017, 3:16 pm.

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.

6 Reviews:

stefanos 09.21.17

stefanos
Rating - {addon_rating_average}

Very powerful Add-on, very easy to use and many url parameters. So flexible that i’m using it to build a site url breadcrumb.

Thanks for this gread add-on !!

Joshua McLemore 02.09.15

Joshua McLemore
Rating - {addon_rating_average}

Using EE 2.9.2 and this seems to be working flawlessly for me. This extension is VERY helpful if you have need of a “back” button or link of some sort (as I do). Thanks to the developer.

atelier 09.16.14

atelier
Rating - {addon_rating_average}

Worked for me in Solspace Friends to set dynamically the referring page in the tag ‘return=......’ In the message module. Thanks!

Oxygen Smith 08.27.13

Oxygen Smith
Rating - {addon_rating_average}

Great for all the reasons mentioned in the description, but I notice it is throwing some minor errors in the developer log in EE 2.6. I’m hoping to see updates coming soon!

fanderson 04.26.13

fanderson
Rating - {addon_rating_average}

Exceptionally helpful and easy to implement. Thank you. I also like your CP Theme - no more pink!

RealJustinLong 08.24.12

RealJustinLong
Rating - {addon_rating_average}

This add-on is just pure genius. It replaces 2 or 3 other little plugins and works flawlessly. I use it on every site I build now.