1 of 2
1
NEW - Fetch Current URI plugin…
Posted: 10 March 2008 03:37 AM   [ Ignore ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

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

File Attachments
pi.fetch_current_uri.php.zip  (File Size: 2KB - Downloads: 171)
Fetch Current URI - V1.02.zip  (File Size: 3KB - Downloads: 6)
 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 10 March 2008 04:41 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

Plugin now updated to V1.0.1 wink

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 wink Updated plugin at top of thread.


Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 11 March 2008 09:46 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  120
Joined  02-21-2005

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

 Signature 

Atelier2

Atelier Voor Beeldhouwwerken

Profile
 
 
Posted: 11 March 2008 09:53 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

Hiya,

No problems. Glad to have been of some use.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 22 March 2008 07:23 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  141
Joined  03-05-2008

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.

Profile
 
 
Posted: 24 March 2008 11:36 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  249
Joined  09-09-2005

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!

Profile
 
 
Posted: 25 March 2008 07:23 AM   [ Ignore ]   [ # 6 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 April 2008 06:13 AM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  758
Joined  03-16-2002

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

 Signature 

Markus Stolpmann • Expression Engine 1.6.4
Current project: kamaco.info - (german) website for Austrian publication coach K. Matejcek

Profile
 
 
Posted: 14 April 2008 06:34 AM   [ Ignore ]   [ # 8 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 April 2008 06:42 AM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

Hi Markus,

Just for you wink 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

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 April 2008 07:04 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  758
Joined  03-16-2002

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

.Markus

 Signature 

Markus Stolpmann • Expression Engine 1.6.4
Current project: kamaco.info - (german) website for Austrian publication coach K. Matejcek

Profile
 
 
Posted: 14 April 2008 07:14 AM   [ Ignore ]   [ # 11 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006
ms - 14 April 2008 07:04 AM

Your great grin
Thanks a million!!!!!!!!!!!!!!!!!!!!

.Markus

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

Hope it gets you all squared away.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 14 April 2008 08:23 AM   [ Ignore ]   [ # 12 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

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

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 16 April 2008 04:29 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  189
Joined  06-18-2007

This is so what I needed. You Rock.  cool smile

Profile
 
 
Posted: 16 April 2008 05:32 PM   [ Ignore ]   [ # 14 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

Why thank you!! grin

Glad to have been of more help! wink

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

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 09 June 2008 10:52 PM   [ Ignore ]   [ # 15 ]  
Summer Student
Total Posts:  1
Joined  06-08-2008

I’m working on a CSS “sliding doors” navigation menu. The “active” tab has an addition CSS class of “current”.

I would like this to work in a dynamic method by accessing the URI.

I had this working before, but without CSS navigation, rather old-school images as follows (only a sniplet of script):

=======================================================================
<?php
  $full_path = getenv(“REQUEST_URI”);
  $base = dirname($full_path);
  switch ($base) {
      case ’/’:
        include (”/home/globalhemp/www/includes/home.inc”);
        break;
      case ’/About_Us’:
        include (”/home/globalhemp/www/includes/home_about_us.inc”);
        break;
      case ’/Contact_Us’:
        include (”/home/globalhemp/www/includes/home_contact_us.inc”);
        break;
      default:
        include (”/home/globalhemp/www/includes/home.inc”);
        break;
  }
?>
=======================================================================

I would like to know how to perform the same, but in a more dynamic mode since the new navigation menu is CSS enabled and the “active” tab is highlighted by the class “current” and being matched to relevant URI.

For example, the category of “books”:

{if exp:fetch_current_uri == ?????”./books”?????}
  {exp:?????}
      <li id=“current”><a href=”/books/” title=“Books”><span>Books</span></a></li>
  {/exp:?????}
{if:else}
  {exp:fetch_current_uri ?????}
      <li><a href=”/books/” title=“Books”><span>Books</span></a></li>
  {/exp:fetch_current_uri ?????}
{/if}

Whereas the full navigation menu looks like:

<div id=“slidetabsmenu”>
  <ul>
      <li><a href=”/” title=“Home”><span>Home</span></a></li>
      <li><a href=”/body-care/” title=“Body Care”><span>Body Care</span></a></li>
      <li id=“current”><a href=”/books/” title=“Books”><span>Books</span></a></li>
      <li><a href=”/hemp-clothing/” title=“Clothing”><span>Clothing</span></a></li>
      <li><a href=”/crafts/” title=“Crafts”><span>Crafts</span></a></li>
      <li><a href=”/food/” title=“Food”><span>Food</span></a></li>
      <li><a href=”/jewelry/” title=“Jewelry”><span>Jewelry</span></a></li>
      <li><a href=”/twine/” title=“Twine”><span>Twine</span></a></li>
      <li><a href=”/video/” title=“Video”><span>Video</span></a></li>
  </ul>
</div>

THANKS!!!

Profile
 
 
Posted: 10 June 2008 03:13 AM   [ Ignore ]   [ # 16 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5579
Joined  04-15-2006

Hi Global Hemp (That can’t really be your name can it? wink ),

I think for what you are needing you may want to take a look at the latest plugin that I made available the other day - Traverse Segments.

This should hopefully allow you to do what you need with your {if} conditional statements I think.

Let me know if that is any good for you?

This plugin really is exceptionally simple and just does the one job which is to bring back the whole URI.

Hope that helps.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!!
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 17 June 2008 03:08 PM   [ Ignore ]   [ # 17 ]  
Research Assistant
RankRankRank
Total Posts:  839
Joined  08-05-2005

GlobalHemp, this is what I use to make a selected state on a tab.

Profile
 
 
Posted: 26 June 2008 04:21 AM   [ Ignore ]   [ # 18 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  329
Joined  04-23-2008

Mark,

Plugin sounds interesting, but I’m trying to figure out exactly what the use of it would be. Would it be for something similar to just like a permalink you’re looking at, or did you develop this for some other purpose I’m totally clueless about.. Seems useful, but I can’t my head around properly utilizing it.

 Signature 

Now, if only I can combine my two favorite things in the world.. Transformers + ExpressionEngine = Nerd Nirvana
Note to self: I am

not a nerd. I swear.
Profile
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62439 Total Logged-in Users: 28
Total Topics: 76705 Total Anonymous Users: 16
Total Replies: 414408 Total Guests: 573
Total Posts: 491113    
Members ( View Memberlist )