Help with Search Page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
murphydesigns
Forum Newbie
Posts: 7
Joined: Sun Apr 25, 2010 9:23 pm

Help with Search Page

Post by murphydesigns »

Hi There,

I have posted this already but my post has been locked, this is a request for help and I am willing to pay money for assistance. I am having issues with a third party script, and I have yet to receive any free help. So I figure I will up-the-anty, I will offer some money to whoever would be willing to help a new PHP newbie with their issue.

Here are my issues:
1) Search engine results are coming up with black text not grey as I defined
2) The price (from and to) field, and year (from and to) are not yielding any search results

If you are able to assist me in this please let me know ASAP
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Help with Search Page

Post by social_experiment »

Please paste either the url of your locked post, or the code you are using.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
murphydesigns
Forum Newbie
Posts: 7
Joined: Sun Apr 25, 2010 9:23 pm

Re: Help with Search Page

Post by murphydesigns »

The URL of the website is ellerbeckmotors.ca/search.php

Here is the code:

Code: Select all

<!--S:Search-->
<script language="JAVAScript" > 
function Model(newmodel) {

var models = new Array();

{SCRIPT}


for (var i = document.forms[0].model.options.length ; i >= 0 ; i--)
document.forms[0].model.options = null;

if (newmodel == "" )
return "";
//adding the new values;

for (var i = 1 ; i < models[newmodel].length ; i++)
document.forms[0].model.options[i-1] = models[newmodel];


}
</script>
<style type="text/css"> 
<!--
.fontcolor {
color: #C0C0C0;
}
body,td,th {
color: #CCC;
}
body {
background-color: #000;
}
.fontcolor {
color: #C0C0C0;
}
-->
</style>


<body bgcolor="#000000" text="#CCCCCC" class="fontcolor"><form action="search.php" method="get">
<table align=center>
<tr>
<td><span class="fontcolor">Make & Model</span></td>
<td><span class="fontcolor">{MAKE} & {MODEL}</span></td>
<tr>
<td><span class="fontcolor">Price range:</span></td>
<td><span class="fontcolor">FROM: $
<input type="text" name="pf" value="{PF}" size="5">
TO: $<input type="text" name="pt" value="{PT}" size="5">
</span></td>
</tr>
<tr>
<td><span class="fontcolor">Year range:</span></td>
<td><span class="fontcolor">FROM: 
<input type="text" name="yf" value="{YF}" size="5">
TO: <input type="text" name="yt" value="{YT}" size="5">
</span></td>
</tr>
<tr>
<td align=center colspan=2><span class="fontcolor">
<input type="submit">
</span></td>
</tr>
</table>
</form>
<!--E:Search-->

<!--S:Select-->
<select name="{NAME}" onChange="{ONCHANGE}">
<option value="">[ select ]</option>
{OPTIONS}
</select>
<!--E:Select-->

<!--S:SelectOption-->
<option {SELECTED} value="{VALUE}">{NAME}</option>
<!--E:SelectOption-->
Here is the search.php code:

Code: Select all

<?php

require "config.php";

$_PAGE = "index";
$_GET["sub"] = "search";

$site = new CSite("admin/site.xml");
$site->Run();
?>
Last edited by Benjamin on Mon Apr 26, 2010 10:08 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Help with Search Page

Post by social_experiment »

You will have to paste the method Run() from the class CSite. Or upload the 'config.php' file (removing any database vitals i.e username, password, database name).
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
murphydesigns
Forum Newbie
Posts: 7
Joined: Sun Apr 25, 2010 9:23 pm

Re: Help with Search Page

Post by murphydesigns »

Here is the config.php file:

Code: Select all

<?php
define("_LIBPATH","./admin/lib/");
require_once _LIBPATH . "site.php";
?>

Code: Select all

<config upload="./upload/" path="../" url="../">

	<formspath>./forms/</formspath>
	<default_location>index.php</default_location>

	<forms>
		<adminpath>./forms/admin/</adminpath>
		<userpath>./forms/user/</userpath>
		<admintemplate>./templates/form.htm</admintemplate>
		<sitepath>./forms/</sitepath>
		<sitetemplate>./admin/templates/form.htm</sitetemplate>
	</forms>

	<database type="mysql">
		<server>sql5c11b.megasqlservers.com </server>
		<login>*********</login>
		<password>***********</password>
		<default>***************</default>
	</database>

	<tables>
		<table name="make">site_make</table>
		<table name="cars">site_cars</table>
		<table name="users">site_users</table>
		<table name="vars">site_vars</table>
		<table name="photos">site_photos</table>
	</tables>

	<templates path="./templates/">

		<template name="layout">layout.html</template>
		<template name="details">details.html</template>
		<template name="list">list.html</template>
		<template name="paging">paging.html</template>
		<template name="error">error.html</template>
		<template name="search">search.html</template>


		<admin path="./templates/admin/">
			<template name="login">login.htm</template>
			<template name="layout">layout.htm</template>
			<template name="js">js.htm</template>
		</admin>
	</templates>
</config>
Last edited by Benjamin on Mon Apr 26, 2010 10:07 pm, edited 1 time in total.
Reason: Added [syntax=xml] tags.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Help with Search Page

Post by Benjamin »

Start using [syntax] tags. Seriously.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: Help with Search Page

Post by social_experiment »

murphydesigns wrote:Here is the config.php file:
You pasted an XML file. What about 'site.php'?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
murphydesigns
Forum Newbie
Posts: 7
Joined: Sun Apr 25, 2010 9:23 pm

Re: Help with Search Page

Post by murphydesigns »

Here is site.php

Code: Select all

<?
session_start();

error_reporting(0);

require_once _LIBPATH . "common.php";
require_once _LIBPATH . "xml.php";
require_once _LIBPATH . "template.php";
require_once _LIBPATH . "config.php";
require_once _LIBPATH . "html.php";
require_once _LIBPATH . "database.php";
require_once _LIBPATH . "vars.php";
require_once _LIBPATH . "menu.php";
require_once _LIBPATH . "library.php";
require_once _LIBPATH . "sqladmin.php";
require_once _LIBPATH . "forms.php";
require_once _LIBPATH . "mail.php";

class CBase {
	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $html;
	
}
class CSite {

	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $admin;
	/**
	* description
	*
	* @var type
	*
	* @access type
	*/
	var $html;
	

	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function CSite($xml , $admin = false) {
		global $_CONF , $base;

		$this->admin = $admin;

		//loading the config
		$tmp_config = new CConfig($xml);

		$_CONF = $tmp_config->vars["config"];

		//loading the templates
		if ($this->admin) {
			if (is_array($_CONF["templates"]["admin"])) {
				foreach ($_CONF["templates"]["admin"] as $key => $val) {
					if ($key != "path")
						$this->templates[$key] = new CTemplate($_CONF["templates"]["admin"]["path"] . $_CONF["templates"]["admin"][$key]);
				}			
			}			
		} else {

			if (is_array($_CONF["templates"])) {
				foreach ($_CONF["templates"] as $key => $val) {
					if (($key != "path" ) && ($key != "admin"))
						$this->templates[$key] = new CTemplate($_CONF["templates"]["path"] . $_CONF["templates"][$key]);
				}				
			}
		}
		

		$base = new CBase();
		$base->html = new CHtml();
		$this->html = &$base->html;

		//make a connection to db
		if (is_array($_CONF["database"])) {
			$this->db = new CDatabase($_CONF["database"]);

			//vars only if needed
			if ($_CONF["tables"]["vars"]) {
				$this->vars = new CVars($this->db , $_CONF["tables"]["vars"]);
				$base->vars = &$this->vars;
			}

			$this->tables = &$_CONF["tables"];
		}				
		
	}

	function TableFiller($item) {
		if (file_exists("pb_tf.php")) {
			include("pb_tf.php");
		}
	}

	/**
	* description
	*
	* @param
	*
	* @return
	*
	* @access
	*/
	function Run() {
		global $_TSM;

		if (file_exists("pb_events.php")) {
			include("pb_events.php");
			
			$_TSM["PB_EVENTS"] = @DoEvents($this);
		}

		if (is_object($this->templates["layout"])) {
			echo $this->templates["layout"]->Replace($_TSM);
		}		
	}
}


?>
Post Reply