Jump to content

how to search without database


pixeltrace

Recommended Posts

You could, in theory, do it with PHP.

 

First off, create a page called pages.db.php.

 

Put the content for each page on 1 line per page. For example:

 

page1contentblahblahblah

page2contentwithslightlymoreblah

page 3 content with spaces

 

Ok, then, on each of your pages, use

 

$pages = file_get_contents('pages.db.php');

Then,

$page = explode('\n', $pages);

 

What you now have, is a $page array. Then, where you want the content on your page, <?php echo $page['number of page here']; ?>

 

'number of page' being the nth line in your sequence, eg. The home may be on the first line, and therefore, <?php echo $page[0]; ?> would be the code to use. Then, for the search engine:

 

create search.htm and search.php.

 

In search.htm, create a form with a textbox (called searchbar) and a submit button, the action being search.php. In search.php, use the following code(s):

 

$search = $_POST['searchbar'];

$page = file_get_contents('pages.db.php');
$pages = explode('\n', $page);
foreach($pages as $pageinfo){
$pagetags = explode(' ', $pageinfo);
foreach($pagetags as pagetag){
if($search = $pagetag){
echo $pages;
}
}
}

 

Haven't checked it, but that'll be the basis of what you need. It converts all the page's content into search tags, for your engine to pick up. Very simple, but I guess that's the way around it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.