| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| PHP...breadtrail?; Dunno what it's called. | |
|---|---|
| Tweet Topic Started: Jun 15 2005, 06:42 PM (984 Views) | |
| JoeC | Jun 15 2005, 06:42 PM Post #1 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You know what I mean. You go on a site, and at the top, as you browse, a little navtrail creates itself (like at the top of this forum - "InvisionFree > Community Forums > Programming and Scripting Chat") Just wondering how to write PHP to get that. I've tried this: Top of the page:
That bit works. On a link (messy):
Or, more neatly:
But it don't work...and I can't think of how to make it work. Can somebody kind please post the code for this and put me out of my misery? Thanks.
|
![]() |
|
| JCink | Jun 15 2005, 07:21 PM Post #2 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I do it on here: http://jcinkcom.ho8.com/php/sources/admin/...&topicname=tdst But it's controled by GET. My way of displaying it on that page there is extremely messy:
But it does work. I dont know how your site is structured so I dont know if this is of any use... |
![]() |
|
| JoeC | Jun 15 2005, 07:57 PM Post #3 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It's like that I suppose...I'm oding a shop (however long it takes me :P) so it goes Index -> Category -> Subcategory -> Item. I'll dis-assemble that code in the morning, and if anyone has any simpler ideas, please post those too. Thanks ![]() And if anyone can tell me what it's called (I know I heard a name for it with 'bread' in the title), I'd appreciate that too |
![]() |
|
| Sani | Jun 15 2005, 08:00 PM Post #4 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Maybe you can use this as a base..
Say the link is http://mysite.org/?page=spam The code will show..
With "Home" pointing to home.php and "Test" pointing to ?page=spam ![]() Edit: Forgot the slashes.. Slashes are evil.. |
![]() |
|
| Seth | Jun 15 2005, 08:32 PM Post #5 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Oh people. If you want a trail, do it programmatically.
|
![]() |
|
| JoeC | Jun 16 2005, 01:12 PM Post #6 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
OK Seth, thanks for that, I've wrapped it into a function, and just wondering how I can have the trail set as 0 (for Home), and when a link is clicked, have it update. I'm using hyperlinks of ?act=example rather than pages. |
![]() |
|
| JoeC | Jun 17 2005, 06:57 PM Post #7 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Seth? Please can you post the PHP for updating the trail without the page actually reloading (IF it's possible). If not, then how would you suggest I implement the trail when using .. a template, for lack of a better word. |
![]() |
|
| FearKiller | Jun 17 2005, 09:21 PM Post #8 |
|
www.drewscripts.com
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I editted Seth's code. $trail[0] will now update based on what the "act" get variable is assigned to. I've also removed the count() function from the loop and placed it as a variable for performance purposes. No need for PHP to count $trail more than once. Is that what you wanted? |
![]() |
|
| JoeC | Jun 18 2005, 03:09 PM Post #9 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I've modded that script to make it nicer ![]()
Much better ^.^ |
![]() |
|
| James | Jun 18 2005, 04:05 PM Post #10 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Hmm, that top bit doesnt' look very neat. Can't you have 'cat', 'idx', 'item' and 'act' in an array, then run through each and check if the $_GET[ array[x] ] != "" and added it to the trail In JS, it'd look something like:
Or am i being too simple about it? Just seems like you're going to have a lot of if statements if that trail extends further. |
![]() |
|
| JoeC | Jun 18 2005, 04:48 PM Post #11 |
|
Euch! IE tastes horrible!
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
![]() Sorry, the code for that is : arr: I just like the fact you use a var called "arr" ![]() ONtopic, I tried converting it to PHP, and ended up with
But it doesn't work...tried to fix it. Any ideas? |
![]() |
|
| James | Jun 18 2005, 05:28 PM Post #12 |
|
Live to Dream
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Don't you have to use $arr? I'm really not a PHPer at all, i'm just doing this through guesswork and the similarity of JS. and: ........href="#">" . $_GET['cat'] . "</a>"; would be: .........href="#">" . $_GET[ $arr ] . "</a>"; ? |
![]() |
|
| Jory | Jun 19 2005, 08:14 AM Post #13 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
$_GET[ $arr[$i] ] You mean ![]() And does arr.length work in PHP? Shouldn't you do count($arr)
Think this would do it. |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
4:57 AM Jul 11
|



![]](http://b1.ifrm.com/0/1/0/p601690/pipright.png)




4:57 AM Jul 11