2 of 2
2
NEW - Fetch Current URI plugin…
Posted: 26 June 2008 05:04 AM   [ Ignore ]   [ # 19 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Hiya,

Not really any specific use really other than someone had asked in this thread about how to get at that information so I thought I would have a go at making a plugin to do just that.

People have used it for different uses such as bread-crumb trails and the like but really it does just what it says on the tin (tin is located at the top post! wink ).

If people find a use for it then great but I really just made it to help someone out in a post the once and thought I would place it into the plugins forum for people to use.

One plugin that I just created that you may (or may not) find useful though - depending on if you use comments on your site or not - is my new Group Comment plugin.

Sorry I can’t give more information on this plugin though as I never used it myself but rather just created it to help someone out.

Speak to you soon.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 23 September 2008 02:37 AM   [ Ignore ]   [ # 20 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1917
Joined  01-05-2007

Hi Mark,

I love the plugin smile

do you know if I can build a url and use a variable then grab the content using $_GET?

What I want to do is grab the current URL, pass it along to a popup window which has a tell a friend form.

<a href="{path=" rel="email_page">Email Page</a>


Then in the head of the popup Tell a Friend template I have -

<?php
$url_refer
= $_GET['refer_page'];
?>

Lastly I have this code to output it -

<?php echo $url_refer; ?>
 Signature 

 
Steven Hambleton | Follow me on Twitter!


ExpressionEngine Outsourcing for Marketing, Graphic & Web Agencies
Partner with a professional ExpressionEngine development team to turn your designs into functioning sites.

Profile
 
 
Posted: 23 September 2008 04:29 AM   [ Ignore ]   [ # 21 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Hi Steven,

Unfortunately some of your code is missing above but I think I get what you are after.

I’ve never done it using my plugin as that was just written for one single purpose but what you are after can definitely be done and might be a little easier if you use a session variable as opposed to PHP, just keeps the templates looking a little neater in my mind wink

There’s a very good session variables plugin available here :

Session Variables

You could set the session variable to the current page and then when you go to the next page you should be able to retrieve it really easily. As for using my plugin in conjunction with that one I’ve never tried it so can’t say that it would definitely work but you could always use something like this instead if it doesn’t :

http://www.example.com/{segment_1}/{segment_2}/{segment_3}/{segment_4}/{segment_5}

and so on and so forth up until 9 segments and do it that way I guess instead. You could also write a simple plugin which would do all this for you too probably so that you would find the URI first and then write it into a session variable and then have a tag on your next page which brings back the session variable again. So basically taking my plugin and the session variables plugin and creating them as one entity.

Hope some of that helps.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 18 February 2009 08:23 PM   [ Ignore ]   [ # 22 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  435
Joined  07-31-2007

not sure if that’s a limitation of plugin architecture or if you can do something about it, but it doesn’t seem to work in a form return…

I wanted to have people redirected where they left off after loging in… Looking at your plugin I found what I needed though wink

setting the PHP parsing on input, something like that does the trick:

<?php
    
global $FNS;
    
$koko = $FNS->fetch_current_uri();
?>
{exp
:member:login_form return="<?=$koko?>"}
// etc...

PS: in case you’re wondering, “koko” means “here” in Japanese… I like to use Japanese for my variables, it usually takes care of potential conflicts thoroughly wink

 Signature 

——————————————————-
Perfection is not when there is nothing to add, but when there is nothing to take away.

Profile
 
 
Posted: 27 February 2009 06:18 PM   [ Ignore ]   [ # 23 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  523
Joined  03-18-2007

Nice work on this Mark! It was exactly what I needed, and I didn’t want to enable PHP in this particular template.

 Signature 

Follow me on Twitter: twitter.com/mrw

Profile
 
 
Posted: 28 February 2009 05:29 AM   [ Ignore ]   [ # 24 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006
slapshotw - 27 February 2009 06:18 PM

Nice work on this Mark! It was exactly what I needed, and I didn’t want to enable PHP in this particular template.

Glad to hear it. Thanks for the kind words.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 March 2009 10:48 AM   [ Ignore ]   [ # 25 ]  
Summer Student
Avatar
Total Posts:  17
Joined  07-31-2007

Adding a friendly amendment to the script: the ability to strip index.php from the url via a property (no-index=“true”)

I’ve updated the docs and such as well.

File Attachments
pi.fetch_current_uri-1.0.3.php.zip  (File Size: 3KB - Downloads: 79)
 Signature 

Aaron Gustafson
Principal
Easy! Designs, LLC

Profile
 
 
Posted: 08 March 2009 10:53 AM   [ Ignore ]   [ # 26 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Erm sorry is this a request or something you have done?

No link to any new download anywhere that I can see.

B.T.W. If you have made some additions then you could have just asked me to do them first. I’m quite approachable you know wink

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 March 2009 10:58 AM   [ Ignore ]   [ # 27 ]  
Summer Student
Avatar
Total Posts:  17
Joined  07-31-2007
Mark Bowen - 08 March 2009 10:53 AM

No link to any new download anywhere that I can see.

I thought I had an error in the zip and was re-uploading it.

Mark Bowen - 08 March 2009 10:53 AM

B.T.W. If you have made some additions then you could have just asked me to do them first. I’m quite approachable you know wink

No worries. I didn’t intend to step on any toes, I was (literally) just making the change and figured since it was a Sunday morning, I’d just go ahead and post it. Didn’t expect you’d be around.

Feel free to adjust what I’ve done as you see fit grin

 Signature 

Aaron Gustafson
Principal
Easy! Designs, LLC

Profile
 
 
Posted: 08 March 2009 11:02 AM   [ Ignore ]   [ # 28 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006
Aaron Gustafson - 08 March 2009 10:58 AM
Mark Bowen - 08 March 2009 10:53 AM

No link to any new download anywhere that I can see.

I thought I had an error in the zip and was re-uploading it.

Ah okay I see now wink

Aaron Gustafson - 08 March 2009 10:58 AM
Mark Bowen - 08 March 2009 10:53 AM

B.T.W. If you have made some additions then you could have just asked me to do them first. I’m quite approachable you know wink

No worries. I didn’t intend to step on any toes, I was (literally) just making the change and figured since it was a Sunday morning, I’d just go ahead and post it. Didn’t expect you’d be around.

As some might know in here I’m always around, an all seeing user me!! grin

Aaron Gustafson - 08 March 2009 10:58 AM

Feel free to adjust what I’ve done as you see fit grin

I’m sure what you have done is fine but will check it out a little later on.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 15 March 2009 11:55 AM   [ Ignore ]   [ # 29 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  827
Joined  12-01-2002

This seems like a great plugin, but I find its making too many adjustments for my use. I just want the current url returned, so I can add to it.  For example, I’m trying to modify this url: http://www.nonprofit-tech.org/index.php/search/topics/tag/communication

I want the full url returned, then I plan to just add a ‘,tag’ to allow rapid adjustments of the search query that Solspace Tags are doing.  But the plugin actually returns a modified url:

http://www.nonprofit-tech.org/search/topics/tag/communication/,engagement

Note that its stripped the index.php from the url (which is required because otherwise my .htaccess code throws a Disallowed characters error), and it adds a closing / which I don’t want, because I want the url exactly as it displays in the URL box, not cleaned up.

The additional functions seem great, but applying them on the default and without control seems to defeat the purpose of the plugin, at least for us who just need an easy way to grab, the exact url of the current page. Is there anyway to turn these modifications off. My current usage looks like:

<a href="{exp:fetch_current_uri uri-only=" title="{tag}">{tag}</a>
Profile
 
 
Posted: 15 March 2009 12:11 PM   [ Ignore ]   [ # 30 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Hiya,

When you say the modifications then do you mean with the plugin that Aaron posted above? If so then you can still download the original plugin from my first post if you wish.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 15 March 2009 12:24 PM   [ Ignore ]   [ # 31 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  827
Joined  12-01-2002

No, I’m just using version 1.02 of the original plugin. I also tried version 1.00.  I believe the problem maybe that the plugin is pulling the details from EE itself and not the $_SERVER . I don’t know. But the fact that I’m stripping out the index.php everywhere else in EE and the addition of the / is reflected in the url, at the base level. I even went into PHP and just added the line

<?php global $IN; echo $IN->URI; ?>

  and the adjustments are reflected there as well.

I’ve currently just switched to

<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ?>

but am trying to figure out how to store as a variable or something shorter so I can build the url from that.

Profile
 
 
Posted: 15 March 2009 12:30 PM   [ Ignore ]   [ # 32 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Ah I see what you mean now. You are indeed right that the plugin creates the URL using built-in ExpressionEngine code methods. I didn’t want to use server variables as I wasn’t too well versed with them when I wrote the plugin so just went with the built-in functions instead.

Saying that though you can very easily create a current URL by doing something like this though :

{homepage}{segment_1}/{segment_2}/{segment_3}/{segment_4}/{segment_5}/{segment_6}/{segment_7}/{segment_8}/{segment_9}

That should hopefully get you what you need?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 16 December 2009 02:42 PM   [ Ignore ]   [ # 33 ]  
Grad Student
Rank
Total Posts:  41
Joined  12-27-2006

Helloo.

Can this easily be updated to be EE2.0 compatible? I’m using it in a site i’m upgrading to EE2.0!!


Thanks.

Profile
 
 
Posted: 16 December 2009 05:31 PM   [ Ignore ]   [ # 34 ]  
Grad Student
Rank
Total Posts:  41
Joined  12-27-2006

I’m definitely not a hardcore coder by any means, but it turns out i’m pretty good at modyfing! I compared this plug-in to an EE2.0 plug-in and attempted to make some tweaks to make it work with EE2.0.. and much to my surprise it worked!

I’m not sure if i’m allowed to post the altered file / whether you plan to do it yourself Mark?

Profile
 
 
Posted: 05 February 2010 02:25 PM   [ Ignore ]   [ # 35 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  05-22-2008

Agreed with the above, I’d definitely like to use this wit EE 2.0 unless there is a function in 2.0 to do the same already?

 Signature 
Profile
 
 
Posted: 05 February 2010 03:13 PM   [ Ignore ]   [ # 36 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10831
Joined  04-15-2006

Oops sorry for not replying to this one sooner everyone.

Salmoon that’s fine if you want to post the 2.0 version by all means.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
   
2 of 2
2
 
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 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120486 Total Logged-in Users: 54
Total Topics: 126559 Total Anonymous Users: 19
Total Replies: 665414 Total Guests: 277
Total Posts: 791973    
Members ( View Memberlist )