We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

NEW - Fetch Current URI plugin…

Development and Programming

Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Just another exceptionally quick plugin in case anyone needs the functionality.

I was asked over in this thread how to fetch the current page URI and I had said that you could either use the {homepage} variable mixed in with {segment} variables or you could use the fetch_current_uri function or the tracker array session although this last one would only work once a person had been to one page first.

I’m hoping there isn’t an easier way that I have just overlooked. There might be as I didn’t really get any sleep last night due to the 54Kt winds we experienced here!!

Anyway, plugin attached to do just what it says on the tin and nothing more!!

Usage : V1.0 Simply place the following plugin tag in to your template where you would like to display the current page URI.
{exp:fetch_current_uri}
That’s it!
Usage: V1.0.2 Fetch the current page URI and render it to the template. Just place the following plugin tag on the page where you would like the page URI to be displayed.
{exp:fetch_current_uri text="Link Text" title="My Title" class="css-class" id="my-id" rel="internal" uri-only="yes"}
uri-only=”yes” or uri-only=”no” - If this parameter isn’t supplied then the plugin will create links along with the other parameters shown below. If supplied however then there are two values, yes and no which can be used. Using no is the same as omitting the parameter whereas yes will allow you to just return the current uri without turning it into a link. text=”Link Text” - text that displays on the page instead of the URI If you leave the text=”” parameter blank then it will instead place the URI in place of any text that you would have wanted! title=”My Title” - text that gets set in the link title (check source code on page) class=”css-class” - sets the class of the link id=”my-id” - sets the id of the link rel=”internal” - sets the rel for the link

Hope it helps some people out somewhere.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Plugin now updated to V1.0.1 😉

Usage :

Place the following plugin tag in to your template where you would like to display the current page URI :

{exp:fetch_current_uri text="Link Text" title="My Title" class="css-class" id="my-id" rel="internal"}

text=”Link Text” - text that displays on the page instead of the URI If you leave the text=”“ parameter blank then it will instead place the URI in place of any text that you would have wanted!

title=”My Title” - text that gets set in the link title (check source code on page) class=”css-class” - sets the class of the link id=”my-id” - sets the id of the link rel=”internal” - sets the rel for the link

Hope that helps out a bit 😉 Updated plugin at top of thread.

Best wishes,

Mark

       
atelier2's avatar
atelier2
181 posts
17 years ago
atelier2's avatar atelier2

Thanks a lot for this plug-in, it surely did help me out!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

No problems. Glad to have been of some use.

Best wishes,

Mark

       
seajay's avatar
seajay
109 posts
17 years ago
seajay's avatar seajay

I was just looking for this exact function today! And then I discovered you’d recently released this plugin. Wow.

As an EE newbie, I’m starting to recognize the contributions you make to this community.

Thank you very much.

       
municipal's avatar
municipal
165 posts
17 years ago
municipal's avatar municipal

Thanks very much for this! Just like seajay, it came along at exactly the right time for me as well. Am using it successfully where I have to simply spit out the current url and use it in a hidden input in a form. (Using your first version without the fancy schmancy stuff you added later). Again, thank you!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya both,

Thanks for the kind words. Glad it has been of some assistance to you. Don’t forget to post links to your sites in the Showcase forum if you can.

Good luck with everything.

Best wishes,

Mark

       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

Mark,

thanks for the plugin, simple but effective.

Now I just wished there would be an option for a plain URI output without the HTML anchor tag around at all. (In case you’re wondering: Used for a no-brain “tell your fiend via E-Mail” JS snipplet on a site where the “HTLM variant” is used as well. Of course I can modify your plugin accordingly, but I don’t like the idea to make an internal branch here.)

.Markus

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Markus,

Thanks for the kind words. Did you try downloading the pi.fetch_current_uri.php.zip plugin from the top post. I’m pretty sure that one should do what you are after. The one with the version numbers has all the link options added in but the top one should do what you are after hopefully?

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hi Markus,

Just for you 😉 A quick update to the plugin V1.0.2 in the top thread now allows you to have an optional uri-only=”yes” parameter which if included will just spit out the text instead of a link. Leave the parameter out to use the plugin in the standard way.

Hope that helps.

Best wishes,

Mark

       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

You’re great 😊 Thanks a million!!!!!!!!!!!!!!!!!!!!

.Markus

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen
Your great 😊 Thanks a million!!!!!!!!!!!!!!!!!!!! .Markus

Well I wouldn’t go that far but thanks for the kind words 😉

Hope it gets you all squared away.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Just as a quick note. V1.0.2 has had a couple of very minor updates. I noticed something odd with the rendered output especially with the title element not being output and also updated the instructions a bit.

Best wishes,

Mark

       
JCI's avatar
JCI
144 posts
17 years ago
JCI's avatar JCI

This is so what I needed. You Rock. :coolsmile:

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Why thank you!! 😊

Glad to have been of more help! 😉

Don’t forget to link to where you are using it so I can see the great things everyone is doing with it 😉

Best wishes,

Mark

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.