Re: Limit Local Search to Content

From: Date: Thu, 26 Mar 2009 17:56:19 +0000
Subject: Re: Limit Local Search to Content
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-290709@lists.php.net to get a copy of this message
2009/3/26 George Langley <george.langley@shaw.ca>: >        Hi all! Am building a Search feature following the excellent tutorial at: > > > <http://www.oreillynet.com/pub/a/php/2002/10/24/simplesearchengine.html> > > It loops through a page and stores the words found in a mySQL database. >        I have about 60 pages, and all of them share a number of common items like header, > menu, footer, etc. These get added as includes. The result is that every page gets marked as having > "Contact Us", "Terms of Use" or any other item in the menu, footer, etc. I would > like to limit the word list to items found just in the page's unique content. >        I do have a div with an id of "divContent" for the actual content. So I > could add an if statement to only start storing words found after the word "divContent" > has been found. But, my question is: > > How do I STOP it? Is it permissible to add the id again in the closing div tag ie </div > id="divContent">. > >        If this is allowed, I could keep an eye out for that id again and stop it when found > a second time, so that my list doesn't include items in the footer (which again is common to > all 60 pages) or any other items outside of the content section. Or is there a better way to trigger > the recording of words on/off? Thanks! You can't have any extra info in a closing HTML tag. This problem is usually handled using comments. Something like the following... <div id="divContent"> <!-- content begin --> sofihsod hiosdh sdh gus us u sg <!-- content end --> </div> You then just start with you see the begin comment and stop when you hit the end comment. -Stuart -- http://stut.net/

« previous php.general (#290709) next »