I could not find a good tutorial for how to generate tabs in html page. I would like to create a function that automatically generates a tab from database information.
I was thinking something along these lines.
- 开发者_开发技巧
Get categories from DB.
IF(!EMPTY(gategory))
{ create a new tab, named after the category. }
Could somebody please link me to a good tutorial or maybe give an example. Thank you.
Well, you know PHP is a server-side technology and there's no way for creating tabs in the client-side without JavaScript help!
In that case, check jQuery UI / Tabs:
- http://jqueryui.com/demos/tabs/
You'll need to initialize your script by forming some JSON and iterating an array of tabs information so you should have enough for creating the whole markup that jQuery UI tabs needs in order to get initialized.
精彩评论