在我正在开发的网站上(beta.btcbidder.com)我正在尝试将搜索框及其类别列表排在顶部的用户栏中。
如果您访问该页面,您将看到搜索框和类别如何排列不正确。
以下是代码:
<menu type="toolbar" id="userbar">
<a href="<?php echo base_url(); ?>"><img align=left src="/media/images/logo.png" alt="BtcBidder.com" ></img></a>
<li><a href="<?php echo site_url(); ?>listings/">Listings</a>
<menu id="listing-categories">
<li><a href="<?php echo site_url(); ?>listings/all/">Browse All Listings…</a></li>
<li><a href="<?php echo site_url(); ?>listings/search/">Search Listings</a></li>
</menu>
</li>
<li><a href="<?php echo site_url(); ?>account/">My Account</a>
<menu id="account-menu">
<li><a href="<?php echo site_url(); ?>account/balance/">My Balance</a></li>
<li><hr /></li>
<li><a href="<?php echo site_url(); ?>account/my-bids/">My Bids</a></li>
<li><a href="<?php echo site_url(); ?>account/my-listings/">My Listings</a></li>
<!--<li><a href="<?php echo site_url(); ?>account/my-watchlist/">My Watchlist — Coming soon!</a></li>-->
<li><hr /></li>
<li><a href="<?php echo site_url(); ?>account/messages/">Messages</a></li>
</menu>
</li>
<!--THIS SECTION IS THE SEARCH BAR -->
<!----------------------------------->
<li>
<form id="search" action="#" method="post">
<input id="q" name="q" type="text" placeholder="search..." />
<select id="q_category" name="q_category">
<option value="">All Categories…</option>
<?php
$query = $this->db->query('SELECT * FROM tbl_category ORDER BY parent_fk ASC, title ASC;');
foreach($query->result() as $row) {
$key = ($row->parent_fk == "")? $row->category_pk : $row->parent_fk;
$search_categories[$key][] = $row;
}
foreach($search_categories as $key=>$val) {
printf(' <option value="%s">%s</option>' . "\n", $val[0]->slug, $val[0]->title);
if(count($val) > 1) {
foreach($val as $categorykey=>$categorydata) {
if($categorykey > 0) {
printf(' <option value="%s"> & hellip;%s</option>' . "\n", $categorydata->slug, $categorydata->title);
}
}
}
}
?>
</select>
<input id="q_submit" name="q_submit" type="submit" value="Search »" />
</form>
</li>
<!--THIS ENDS THE SEARCH BAR -->
<!----------------------------------->
<?php /* <li><a href="">Administration</a>
<menu id="administration-menu">
<li><a href="">Manage Disputes</a></li>
<li><a href="">Manage Listings</a></li>
<li><a href="">Manage Categories</a></li>
<li><hr /></li>
<li><a href="">Manage Users</a> </li>
<li><a href="">Banned Users List</a></li>
<li><a href="">Manage Banned Wordlist</a></li>
<li><hr /></li>
<li><a href="">Ban this User</a></li>
<li><a href="">Delete this Listing</a></li>
</menu>
</li>*/ ?>
<li><a href="">Signup</a></li>
<li class="right"><a href="<?php echo site_url(); ?>login/">Login</a></li>
<?php include(APPPATH . 'views/ticker.inc.php'); ?>
</menu>