mrdeleigh Posted May 24, 2007 Share Posted May 24, 2007 Hi I have a blog that has many bloggers and I'm looking for a script that looks like google ads, so when you open a blog it runs down the side and displays all other blogs that has simular content. (most recent at the top ) can anyone help me? Thanks mrdeleigh Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/ Share on other sites More sharing options...
MadTechie Posted May 24, 2007 Share Posted May 24, 2007 basically MySQL + Timestamp.. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260738 Share on other sites More sharing options...
penguin0 Posted May 24, 2007 Share Posted May 24, 2007 and when you are displaying the blogs do ORDER BY $yourtimestampvar Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260746 Share on other sites More sharing options...
mrdeleigh Posted May 24, 2007 Author Share Posted May 24, 2007 think I'm in over my head here!!! does anyone have a sample? Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260814 Share on other sites More sharing options...
MadTechie Posted May 24, 2007 Share Posted May 24, 2007 knew that was comming.. without knowing you system.. we can't suggect anything.. its just a case of adding a field (type date), then tweaking the sql statement.. maybe if you posted some code..! Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260831 Share on other sites More sharing options...
Dragen Posted May 24, 2007 Share Posted May 24, 2007 but he's not wanting it ordered by date.. He wants to list blogs that are similar to the currently viewed one.. I think I guess you could have a field in the table called 'keywords' or similar and then the sidebar could just display the first 5 (or however many) bloggs that have some of thte same keywords. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260835 Share on other sites More sharing options...
mrdeleigh Posted May 24, 2007 Author Share Posted May 24, 2007 thanks for the replys but he's not wanting it ordered by date.. He wants to list blogs that are similar to the currently viewed one.. I think I guess you could have a field in the table called 'keywords' or similar and then the sidebar could just display the first 5 (or however many) bloggs that have some of thte same keywords. thats correct but instead of keywords can it search the blog text? Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-260952 Share on other sites More sharing options...
Dragen Posted May 24, 2007 Share Posted May 24, 2007 I guess you could, but it would be more difficult because you'd need some way of detecting certain words, otherwise you'll probably end up with lots of blogs that include the words 'and', 'the', 'it', etc. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261081 Share on other sites More sharing options...
mrdeleigh Posted May 25, 2007 Author Share Posted May 25, 2007 otherwise you'll probably end up with lots of blogs that include the words 'and', 'the', 'it', etc. good point can it be done? Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261435 Share on other sites More sharing options...
Dragen Posted May 25, 2007 Share Posted May 25, 2007 yes, but it'll be difficult. You'd need a search function which goes through each blog and checks it for words similar to in the blog being displayed.. I guess you could get it to filter out certain words from the search. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261445 Share on other sites More sharing options...
mrdeleigh Posted May 25, 2007 Author Share Posted May 25, 2007 does anyone have a sample of this? Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261509 Share on other sites More sharing options...
MadTechie Posted May 25, 2007 Share Posted May 25, 2007 try yourself and when you get stuck post what you have.. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261761 Share on other sites More sharing options...
mrdeleigh Posted May 25, 2007 Author Share Posted May 25, 2007 I'm a complete newbie with this so I would not know where to start with this anyone got an idea? Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261763 Share on other sites More sharing options...
Dragen Posted May 25, 2007 Share Posted May 25, 2007 try google. I've given you some ideas of where to start. Try searching for similar things, you might find a tutorial. You need to look into databases, and forms using php. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261766 Share on other sites More sharing options...
jamina1 Posted May 25, 2007 Share Posted May 25, 2007 You could also just add keywords to your blog posts, and it could list posts with the same keywords by their date. That would be simplest. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261772 Share on other sites More sharing options...
Dragen Posted May 25, 2007 Share Posted May 25, 2007 You could also just add keywords to your blog posts, and it could list posts with the same keywords by their date. That would be simplest. already been suggested but he's not wanting it ordered by date.. He wants to list blogs that are similar to the currently viewed one.. I think I guess you could have a field in the table called 'keywords' or similar and then the sidebar could just display the first 5 (or however many) bloggs that have some of thte same keywords. Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261781 Share on other sites More sharing options...
Barand Posted May 26, 2007 Share Posted May 26, 2007 You could use a FULLTEXT search, which ignores words less than 4 chars long. Have a play with this ::DATA:: CREATE TABLE `blog` ( `id` int(10) unsigned NOT NULL auto_increment, `blogdate` date NOT NULL, `content` varchar(255) NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `FTIndex_2` (`content`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `blog` (`id`,`blogdate`,`content`) VALUES (1,'2007-01-01','Dolphins are aquatic mammals'), (2,'2007-01-05','Gerbils are mammals'), (3,'2007-01-10','bullrushes are aquatic plants'), (4,'2007-01-15','My friend plants trees for a living'), (5,'2007-01-20','My garden shed is built of bullrushes'), (6,'2007-01-25','Dolphins are your friend'); ::SCRIPT:: <?php include '../test/db2.php'; if (isset($_GET['id'])) { $id = $_GET['id']; $sql = "SELECT id, blogdate, content FROM blog WHERE id = '$id' "; $res = mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); if (list ($id, $d, $c) = mysql_fetch_row($res)) { echo '<b>', date('jS F', strtotime($d)), '</b><br>', $c, '<hr><b>Similar blog entries</b><hr>'; $sql = "SELECT blogdate, content FROM blog WHERE MATCH(content) AGAINST('$c') AND id <> '$id' ORDER BY blogdate DESC"; $res = mysql_query($sql) or die (mysql_error()."<p>$sql</p>"); while (list ($d, $c) = mysql_fetch_row($res)) { echo '<b>', date('jS F', strtotime($d)), '</b><br>', $c, '<br><br>'; } echo '<hr>'; } } ?> <form> Select a blog record (1-6) <input type='text' name='id' size='4'> <input type='submit' name='action' value='Submit'> </form> Quote Link to comment https://forums.phpfreaks.com/topic/52811-looking-for-a-search-script/#findComment-261901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.