linkable tab script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

linkable tab script?

Post by matt1019 »

Hi everyone,

I had a question regarding all the "tab" scripts out there on the net.

I have been looking every where for a script like this one:

I would like to know if something like this exists, and if so... what is it called?? (I mean, there has to be a different name than a "Tab Script").


I am looking for a tab script that can be defined in the following way: each tab has an "ID" so if I make a link in index.php like:

Code: Select all

<a href="http://localhost/edit.php?id='2'">This will open the page with "Second Tab" Selected</a>
on edit.php page, the tab panel will be opened with the second tab as the "selected" tab.

Please let me know if I confused anyone :oops:

thanks very much.

-Matt
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

you could do something like this:

Code: Select all

$tab = $_GET['tab'];
if($tab == 1){
     //output what you want on tab one here
}
if($tab == 2){
     //output what you want on tab two here
}
if($tab == 3){
     //output what you want on tab three here
}
ect.ect.ect.

i hope thats what you ment

and if thats what you want you would like to it like tabbed_page.php?tab=1
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

Hi Dull,

Thanks for the reply :)

I am looking for something like this:

http://codethat.com/tab/api_ex.html

you select from a dropdown list to set which tab will be active.

So my question is, how can I make a link out of it? (instead of a dropdown list)

(reffering to the script found on the above mentioned site)


-Matt
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

Nevermind guys, I got it.

Here's the link incase someone like me comes along in the future :lol:

http://codethat.com/tab/url_ex.html?p=0

change p=0 to 0,1,2, or 3

for example:
http://codethat.com/tab/url_ex.html?p=0
http://codethat.com/tab/url_ex.html?p=1
http://codethat.com/tab/url_ex.html?p=2
or
http://codethat.com/tab/url_ex.html?p=3

and you will see what I mean 8)

And these types of tabs are called "Tabs with urlParam"

Anyone knows any other names these are reffered as?

thanks once again, and thanks to Dull for his help also! :)


Regards,

-Matt
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

You could also do any and all of that in just Javascript..
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

@Jenk:

know of any particular tab script that does this?

if you do, could you please let me know. :)

Thanks,

-Matt
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

now is it allright if I bump?

:)

-Matt
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

Jenk wrote:You could also do any and all of that in just Javascript..
the page that is mentioned above is in javascript, its a nifty simple exampl of client-side interactive material.
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

so you are saying that an example like this (a freeware version) exists?

could you be kind enough and please point me in the right direction :)

-matt
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

I think you might be looking for http://onlinetools.org/tools/domtabdata/ from Christian Heilmann (also worth checking is his upcoming book http://www.beginningjavascript.com/)
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

Hi matthijs,

Thanks for your reply and help.

However, this does not seem to perform same functionality as the example I posted.

What I am looking for in a tab script is that I give it a unique url Param (ID) and it opens on that tab.


Quick example:

I have 3 tabs called: "tab1" "tab2" "tab3"

if I make a link to tab 2, the page should open with tab2 as the active tab and have tab 2 contents.

To better understand what my query is, please take a look at the example script from codethat.com that I posted..... This example explains a lot better what I would like than what I could verbally.


-Matt
matt1019
Forum Contributor
Posts: 172
Joined: Thu Jul 06, 2006 6:41 pm

Post by matt1019 »

Hi matthijs,

I am sorry, I am such an ****arrgh!!!****

This is exactly what I was looking for!

The example page http://onlinetools.org/tools/domtabdata/ did not have "index.html" after "http://onlinetools.org/tools/domtabdata/"

Therefore, all the tests I did online such as:

http://onlinetools.org/tools/domtabdata/#how
http://onlinetools.org/tools/domtabdata/#pr
http://onlinetools.org/tools/domtabdata/#style

did nothing but refresh the page (with the same tab as active tab)

HOWEVER,

I went ahead and downloaded the tabscript from the page you provided anyways.... just to play with it.

and opened it up on my computer and voila!

file:///C:/test/domtab/index.html#pr
file:///C:/test/domtab/index.html#dl
...etc etc etc. you get the idea



NOTICE THE DIFFERENCE, my test (on my computer) had index.html file before #pr and #dl parameters


Thanks once again :D

-Matt
Post Reply