Guest Posted February 22, 2008 Posted February 22, 2008 Hi, I'll like to know how to put the categories from the left column inside a drop down menu instead of the way it's being displayed right now. Also, I'd like to know if its possible to have that drop down menu in other places such as the index.php or the header.php. Thanks in advance. Fabian.
photofxplus Posted February 22, 2008 Posted February 22, 2008 You could do it.. You would need to populate the value of each selection with the url of the category such as: <form name="categories" method=get> <select name="anyname" onChange="redirect()"> <option value="http://mywebsite/catalog/index.php?cID=1">Category 1</option> Then some javascript that would redirect upon change; <script type="text/JavaScript"> <!-- function redirect(){ var URL = document.resources.res.options[document.resources.res.selectedIndex].value; top.location.href = URL; } //--> </script> Or you could add a submit button if you did not want the onchange event. Then you would need to add a function on the other end.. Good luck.. Lloyd
Guest Posted February 24, 2008 Posted February 24, 2008 You could do it.. You would need to populate the value of each selection with the url of the category such as:<form name="categories" method=get> <select name="anyname" onChange="redirect()"> <option value="http://mywebsite/catalog/index.php?cID=1">Category 1</option> Then some javascript that would redirect upon change; <script type="text/JavaScript"> <!-- function redirect(){ var URL = document.resources.res.options[document.resources.res.selectedIndex].value; top.location.href = URL; } //--> </script> Or you could add a submit button if you did not want the onchange event. Then you would need to add a function on the other end.. Good luck.. Thank you Lloyd, but I have another question; As long as I have to type myself the category's name in the drop down menu, it won't be linked to the database, so every time a change or add a new category it won't appear in the menu. Q: Is there any possibility where I can have that code linked to the database so I don't have to change it any more? Thanks Fabian.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.