Some time ago I wanted a drop down menu for my website www.salsamontreal.com. I have search drupal.org and all around but there is nothing like it. The thing is, a jump menu is way better anyway!
What I wanted is this...
SELECT `nid` , `title` FROM `node` WHERE `type` LIKE 'poll' ORDER BY `title` ASC
Put that in a jump menu. So with the code below it list all the poll titles and if you choose one, you will get to that poll. You can change the query to your needs.
I can't put all the code in here since the first time I did that !!!!!!!!%&&*%*&*%%*& of drupal just erase my 4 pages document and told me "Terminated request because of suspicious input data." because of javascript I guess. So get the base of the code here http://www.neowin.net/forum/lofiversion/index.php/about/t159289.html or somewhere else on the net. Somehow I can't find back the original webpage, so, if someone have that kind of info, just reply and send the url. Just take a normal jump menu and complete with this code below...
[missing part here]
<option value="" selected>Choisir une option</option>
<?php
$sql="SELECT `nid` , `title` FROM `node` WHERE `type` LIKE 'poll' ORDER BY `title` ASC";
$result = mysql_query($sql) or die ("Could not retrieve DB content");
while ($row = mysql_fetch_assoc($result)) {
?>
<option value="http://www.salsamontreal.com/montrealsalsa/node/<?php echo $row["nid"];?>" selected><?php echo $row["title"];?></option>
<?php
}
mysql_free_result($result);
?>
Problems and concerns with this code
1- It is code in a node instead of let's say, a field in flexinode.
2- You have to translate it.
3- The selected choice is the last one instead of the "Choisir une option" , did I made an error?
4- You have to change the website base url. Is there a variable for this?
If you want to code some more, I'll create a feature field request in the flexinode module page.
Anyway, it is late here, so I hope that my message is clear ;) ZZzzzzzzzzz
Comments
request...
See the flexinode request here http://drupal.org/node/34238
Alexandre Racine
www.gardienvirtuel.com Sécurité informatique conformité, consultation et plus
Your link to code...
wasnt working but....NEVER MIND..I got to it!