Page 1 of 1

Need and include code for keyword search,,please help.

Posted: Mon Mar 27, 2006 11:55 pm
by phpnewbie1
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I am trying to include a code in my script to make a search fo keywords. 

the code I an trying to include is this:

Code: Select all

<? include 'http://www.yourdomain.com/ezwebsearch/include.php?searchterm=mydesired search term?>
i know to change the domain and the folder, my problem is getting the search=... I dont know what to put there.

and also can I make it an include so I can build this without changing the domain like:

<?php inlude ("../folder/include.php?searchterm=????????I dont know what to put here. Here is my file.


Code: Select all

<?php

include("../rssgm/config.php");

$keyword_dash = $_GET['keyword'];

$keyword_lowercase = str_replace("-", " ", $keyword_dash); 

$keyword = ucwords($keyword_lowercase);

$keyword_feed = str_replace(" ", "+", $mainkeyword); 

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="alternate" type="application/rss+xml" title="RSS 1.0" href="sitemap.xml" />
<title><?php echo $mysitename; ?></title>
<meta name="keywords" content="<?php echo $keyword; ?>">
<meta name="description" content="Real information about <?php echo $mainkeyword; ?> at <?php echo $mysitename; ?>">
<meta name="ROBOTS" content="ALL">
<style type="text/css" media="all">@import "rssgm/style.css";</style>
</head>

<body>
<div id="main">
	<div id="left_column">
		<div id="title">
			<p><?php echo $mysitename; ?></p>
			<p></p>
		</div>
		<a href="<?php echo $site;?>">Home</a><br>
		<a href="<?php echo $site;?>/sitemap.php">Sitemap</a><br>
<?php include("../rssgm/random.php"); ?>

	</div>
	
	<div id="right_column">
		<div class="right_title">
			<h3>Sweet Deals</h3>
			<p align=center>
<?php include("../rssgm/chitika.php"); ?>
			</p>
		</div>
		<div class="info">
			<p>Copyright &copy; <?php echo date("Y"); ?></p>
			<p><?php echo $mysitename; ?></p>
			<p>All Rights Reserved</p>
		</div>
	</div>
		
	<div id="middle_column">
		
		<div class="content_out">
			<div class="content_in">
<?php include("../rssgm/google.php"); ?>

<p><?php include("../rssgm/articles.php"); ?></p>

		 	</p>
		 </div>
	 </div>	

<!-- google_ad_section_start -->
		<div class="content_out">
			<div class="content_in">
		 		<h3><?php echo $mainkeyword; ?> News</h3><br>
		 		<p>

<?php include 'http://www.domain.info/folder/include.php?searchterm="$keyword;"'?>
		 		</p>
		 	</div>
		</div>
		
		<div class="content_out">
			<div class="content_in">
		 		<h3><?php echo $mainkeyword; ?> Links</h3>
		 		<p>

		 		</p>
<!-- google_ad_section_end -->
		 	</div>
		</div>
	</div>
</div>
</body>
</html>
I am just having troube what to put after the equal sign after search term

any suggestions?

Thank you for your help in advance!!!


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue Mar 28, 2006 12:05 am
by feyd
I hope you're aware that including an external page is very dangerous and can greatly slow your script. As for your code, If you used a double quote string, you'd be able to use it, pretty much as-is. Although I would recommend running the term(s) through rawurlencode()

Code: Select all

<?php include 'http://www.4blairs.info/rssgm/include.php?searchterm='.rawurlencode('"' . $keyword . ';"'); ?>