Thumbnail linking to an specific position to a looped <ul>?
« on: Today at 09:19:18 PM »
* Reply with quoteQuote
I found this link to olive Garden http://www.olivegarden.com/menus/ which it has resemblance to what I want to achieved.
If you check at the bottom of the page there are four thumbnails with one image and some text align="center" each.
- Lunch Menu
- Dinner Menu
- Beverage Menu
- Dessert Menu
Now to the left of the web page you will see a <ul> list with a heading call Our Menu the list looks similar to the one below
- Specials
- Lunch
- Dinner
- Beverage
- To go!
- Dessert
If you click on the Lunch Menu Thumbnail at the bottom of the web page, you will realize that it will link you to a page that open the Lunch heading of the <ul> list, displaying all the subheadings within the Lunch heading.
My question is how that achieved?
I know that through the link of the thumbnails the user is directed to a page where it get to activate the while loop embed in the <ul> list to display the subheadings within the Lunch heading line in the <ul> list.
My question could that be achieved?
How many queries would be needed to achieve this requests and effects? how this queries would look like?
And the most important of all How I would get the while loop in the <ul> list to display only the subheadings of the heading being refered to, from the thumbnail link? I know it would be like referring to an specific position inside of the array of the while loop in the <ul> list but how or something similar or maybe there is another way not sure. I just been having difficulties to putting it together.
This is the code I have so far, it has an looped <Ul> list and a looped <table></table> which display the thumbnails.
$sql = 'SELECT id,Subject FROM menusubjects;';
$result = mysql_query($sql);
if($result && mysql_num_rows($result)!=0) {
echo '<ul id="nav-categories">';
while($row = mysql_fetch_assoc($result)) {
$uri = 'example1.php?subject='.urlencode($row['id']);
$class = !is_null($cat) && $cat==$row['id']?' class="selected"':'';
echo "\t",'<li',$class,'><a href="',$uri,'">',$row['Subject'].'</a>';
if($submenu==false && !is_null($cat) && $cat == $row['id']) {
$sql2 = 'SELECT id,shoename FROM regularmenu WHERE menusubject_id = '.mysql_real_escape_string($cat).';';
$result2 = mysql_query($sql2);
if($result2 && mysql_num_rows($result2)!=0) {
echo "\n\t\t",'<ul class="submenu">',"\n";
while($row2 = mysql_fetch_assoc($result2)) {
$uri2 = $uri.'&menu='.urlencode($row2['id']);
$class2 = !is_null($prod) && $prod==$row2['id']?' class="selected"':'';
echo "\t\t\t",'<li',$class,'><a href="',$uri2,'">',$row2['shoename'],'</a></li>',"\n";
}
echo "\t\t",'</ul> <!-- end of ul.submenu -->',"\n";
}
$submenu = true;
}
echo '</li>',"\n";
}
echo '</ul> <!-- end of ul#nav-categories -->',"\n
$sql = "SELECT menusubjects.Subject, menusubjects.image
FROM menusubjects";
$result = mysql_query($sql, $connection);
if(!$result){
die("Database query failed:" . mysql_error());}
while ($content = mysql_fetch_array($result)) {
echo "<table width="260\" height=\"100\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bordercolor=\"#FF0033\" bgcolor=\"#FFFFFF\" style=\"float:left; position:relative; left:206px; top:
300px; height:5px;\">
<td width=\"95%\ height=\"10%\"> <table width=\"96%\" height=\"10%\"> <td style=\"width:100%\"><img src=\"../images/lineforheader.gif\" alt=\"gf\" width=\"100%\" /></td><tr><td bordercolor=\"#666666\" bgcolor=\"#D83607\" height=\"100%\" style=\" width:140px;\"><a href=\"#\">
<div class=\"shoe2\" align=\"left\" style=\"background-image:url(../images/titleshoe.gif);\">" . $content['Subject'] . "</div>
</a></td></tr>
<tr>
<td style=\"width:100%; background:#CC0000; height:2px;\"><a href=\"#\">" . $content['image'] . "</a></td>
</tr></table></td>
</table></td>";
}