Hi
I want to put search form in header area.
For this i have altered the header.php
The altered code is as below.
[code]<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<?php echo SITE_URL; ?>/themes/wpClassifieds/jsclass.js"></script>
<?php
//getting the title in two parts/colors
$pos=strpos(SITE_NAME," ");
$firstH=substr(SITE_NAME,0,$pos);//first part of the site name in green
$secondH=substr(SITE_NAME,$pos);//second part of the name un blue
?>
<div class="container_12" id="wrap">
<div class="grid_12" id="header">
<div id="logo">
" title="<?php echo SITE_NAME; ?>">

<p>
<?php echo ''._("Publish a new Ad").'';?>
</p>
<div class="top_link">
<?php echo _("Login");?> | <?php echo ''._("Publish a new Ad").'';?>
</div>
<div class="clear"></div>
</div>
<form action="'.SITE_URL.'" method="get">
<table cellpadding="2" cellspacing="0">
<tr>
<td><?php echo _("Search");?>:</td><td><input type="text" name="desc" value="<?php echo cG("desc");?>" /></td>
<td><?php echo _("in Category");?>:</td><td>
<?php
$query="SELECT friendlyName,name,(select name from ".TABLE_PREFIX."categories where idCategory=C.idCategoryParent) FROM ".TABLE_PREFIX."categories C order by idCategoryParent";
sqlOptionGroup($query,"category",$currentCategory);
?></td>
<?php if (LOCATION){?>
<td><?php echo _(" at Location");?>:</td><td>
<?php
global $location;
$query="SELECT idLocation,name,(select name from ".TABLE_PREFIX."locations where idLocation=C.idLocationParent) FROM ".TABLE_PREFIX."locations C order by idLocation, idLocationParent";
echo sqlOptionGroup($query,"location",$location);
?>
</td>
<?php }?>
<td> </td><td><input type="submit" value="<?php echo _("Search");?>" /></td></tr>
</table></form>
<!--search end-->
</div>
<div class="clear"></div>
<div id="content">
<div class="grid_12">
<div class="breadcrumb">
<?php if(isset($categoryName)&&isset($categoryDescription))
{ ?>
<?php echo $categoryDescription;?>
<?php echo $categoryName;?>" href="<?php echo SITE_URL.newURL();?>">
<?php echo _("Post Ad in");?> <?php echo $categoryName;?>
<?php }
else echo date("l d, F Y");
?>
<div style="float:right;">
<b><?php echo _("Filter");?></b>:
<?php generatePostType($currentCategory,$type); ?>
</div>
</div>
</div>
<div class="clear"></div>
<div class="grid_8" id="content_main">[/code]
Can u please tell me why it is not performing.
I think there is some error with from action.
Please Advise.
apart from search issue. i have one more Q
what is the code to hyperlink the login page.
I can't read the code, plase paste it in pastebin.com service.
the same link that appears when you click to login, depends your language.
I may have the answer for you here
[code]
<!--search start-->
<div><form action="<?php echo SITE_URL;?>" method="get"><table cellpadding="2" cellspacing="0">
<tr>
<td><?php echo _("Search");?>:</td><td><input type="text" name=\"desc\" id=\"desc\" value="<?php echo cG("desc");?>" /></td>
<td><?php echo _("in Category");?>:</td><td>
<?php
$query="SELECT friendlyName,name,(select name from ".TABLE_PREFIX."categories where idCategory=C.idCategoryParent) FROM ".TABLE_PREFIX."categories C order by idCategoryParent";
sqlOptionGroup($query,"category",$currentCategory);
?></td>
<?php if (LOCATION){?>
<td><?php echo _(" at Location");?>:</td><td>
<?php
global $location;
$query="SELECT idLocation,name,(select name from ".TABLE_PREFIX."locations where idLocation=C.idLocationParent) FROM ".TABLE_PREFIX."locations C order by idLocation, idLocationParent";
echo sqlOptionGroup($query,"location",$location);
?>
</td>
<?php }?>
<td> </td><td><input type="submit" value="<?php echo _("Search");?>" /></td></tr>
</table></form>
<!--search end-->
</div>
[/code]
I started to look for how to put a header in the search bar, found yours and I think it works now I've tweaked it.
Good Luck
Mark
It still has it's faults, sorry
ok, now it works properly (almost). here's the code from container 12 onwards
[code]<div class="container_12" id="wrap">
<div class="grid_12" id="header">
<div id="logo">
<h4>" title="<?php echo SITE_NAME; ?>"><span class="firstH"><?php echo $firstH; ?></span><span class="secondH"><?php echo $secondH; ?></span></h4>
<p><?php echo ''._("Publish a new Ad").'';?></p>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
<div class="grid_12" id="top_dropdown">
<ul id="nav">
<?php generateMenuJS($selectedCategory);?>
</div>
<div class="clear"></div>
<div class="grid_12" style="position:static;" id="top_cats">
<?php generateSubMenuJS($idCategoryParent,$categoryParent,$currentCategory); ?>
</div>
<div class="clear"></div>
<div id="content">
<div class="grid_12">
<div class=" breadcrumb">
<?php if(isset($categoryName)&&isset($categoryDescription)){ ?>
<?php echo $categoryDescription;?>
<?php echo $categoryName;?>" href="<?php echo SITE_URL.newURL();?>"><?php echo _("Post Ad in");?> <?php echo $categoryName;?>
<?php }
else echo date("l d, F Y");
?>
<div style="float:right;"><b><?php echo _("Filter");?></b>:
<?php generatePostType($currentCategory,$type); ?>
</div>
</div>
</div>
<div class="clear"></div>
<div class="grid_8" id="content_main">[/code]
I have attached it to '#top_search' in style.css for the basic wpClassifieds theme, but you will need to add [code].container_12 .grid_17{width:330px}[/code] in style.css or else the background will be the same width as the header.
The only problem is - when searching from the home page, you must have a category selected or it just reverts to the home page again. Location is not essential as it is controlled by an 'if' statement. I cannot apply the same 'if' statement rules to the category box, I'm not that good yet... it would be good (and overcome the problem) to set the category to the first category by default instead of a blank box, maybe Chema has an idea? :-)
Hi MarketUK, I saw your site. it seems you have cracked the issue, Your site now returns some result, even if the category is not selected on index page.
can you share the MOD
Hi Vinod, I had help, and only just got it working last week. I have pasted my header search code at pastebin for you http://pastebin.com/CJtVkxbm
Hope you can make it work too.
Cheers,
Mark
Hi vinod i tried the search code from "Marketup" for my website but it is giving me a blank page when i search for any term. I also checked your website and it is working fine there. Can you please paste the new code. Thank you for your help
You must log in to post.