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”>Books</li> {/exp:?????} {if:else} {exp:fetch_current_uri ?????} <li>Books</li> {/exp:fetch_current_uri ?????} {/if}
Whereas the full navigation menu looks like:
<div id=”slidetabsmenu”> <ul> <li>Home</li> <li>Body Care</li> <li id=”current”>Books</li> <li>Clothing</li> <li>Crafts</li> <li>Food</li> <li>Jewelry</li> <li>Twine</li> <li>Video</li> </ul> </div>
THANKS!!!
Hi Global Hemp (That can’t really be your name can it? 😉 ),
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
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.
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! 😉 ).
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
Hi Mark,
I love the plugin 😊
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="http://{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; ?>
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 😉
There’s a very good session variables plugin available here :
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
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 😉
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 😉
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.
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 😉
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 😊
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 😉
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 😉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!! 😊
Feel free to adjust what I’ve done as you see fit 😊
I’m sure what you have done is fine but will check it out a little later on.
Best wishes,
Mark
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="http://{exp:fetch_current_uri" title="{tag}">{tag}</a>
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.