gammaman Posted July 15, 2012 Share Posted July 15, 2012 Hello again. I am trying to pass the link text name through $_GET to display.php using a funciton which finds the link text. <body> <ul class="sf-menu"> <li class="current"> <a href="display.php?category=">Entertainment</a> <ul> <li> <a href="#aa">menu item that is quite long</a> </li> <li class="current"> <a href="#ab">menu item</a> <ul> <li class="current"><a href="#">menu item</a></li> <li><a href="#aba">menu item</a></li> <li><a href="#abb">menu item</a></li> <li><a href="#abc">menu item</a></li> <li><a href="#abd">menu item</a></li> </ul> </li> Let's just take this small piece for example <li class="current"> <a href="display.php?category=">Entertainment</a> <ul> <li> I want category here to = Entertainment. I don't just want to type it b/c what if I have thousands of category's. Is there some way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/265701-function-to-pass-link-text-as-variable/ Share on other sites More sharing options...
scootstah Posted July 15, 2012 Share Posted July 15, 2012 Surely you're not typing out thousands of categories by hand, are you? I would hope you are storing them in a database, and looping through them. Quote Link to comment https://forums.phpfreaks.com/topic/265701-function-to-pass-link-text-as-variable/#findComment-1361674 Share on other sites More sharing options...
gammaman Posted July 15, 2012 Author Share Posted July 15, 2012 Yes. I am doing exactly that. The next problem is that each category can have an undetermined about of sub categories. Those subcategories could also contain an undetermined amount of subcategories and so on. Any suggestion on the best way to handle this? Should I create tables for all the subcategory levels? I think this is a bit much. I was thinking of somehow assigning an index to each "category" which will determine how deeply nested it is. Quote Link to comment https://forums.phpfreaks.com/topic/265701-function-to-pass-link-text-as-variable/#findComment-1361686 Share on other sites More sharing options...
scootstah Posted July 15, 2012 Share Posted July 15, 2012 Check out these two articles: one two for examples on how to store hierarchical data. Quote Link to comment https://forums.phpfreaks.com/topic/265701-function-to-pass-link-text-as-variable/#findComment-1361692 Share on other sites More sharing options...
gammaman Posted July 15, 2012 Author Share Posted July 15, 2012 Awesome, thanks!!!. Quote Link to comment https://forums.phpfreaks.com/topic/265701-function-to-pass-link-text-as-variable/#findComment-1361715 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.