The Little Guy Posted November 25, 2008 Share Posted November 25, 2008 Anyone have any Idea how to filter text descriptions, like Google's search page? Example: Free software is a matter of the users' freedom to run, copy, distribute, study, ... A program is free software if users have all of these freedoms. ... Google filters the text to only display a portion of the text, and then combines two or portions of text if necessary concatenating them with three periods. Link to comment https://forums.phpfreaks.com/topic/134167-filter-text/ Share on other sites More sharing options...
trq Posted November 25, 2008 Share Posted November 25, 2008 Try substr. Link to comment https://forums.phpfreaks.com/topic/134167-filter-text/#findComment-698442 Share on other sites More sharing options...
waynew Posted November 25, 2008 Share Posted November 25, 2008 $desc = "Free software is a matter of the users' freedom to run, copy, distribute, study, ... A program is free software if users have all of these freedoms."; if(strlen($desc) > 80){ $desc = substr($desc,0,80).' ...'; } echo $desc; Link to comment https://forums.phpfreaks.com/topic/134167-filter-text/#findComment-698464 Share on other sites More sharing options...
The Little Guy Posted November 25, 2008 Author Share Posted November 25, 2008 No... I think I asked my question wrong. Sorry. I have a database, it has video descriptions, for example here is a description of one video I have (Kid Rock - Cowboy): "Cowboy" is a single by Kid Rock from his album Devil Without a Cause. He describes the song as "Lynyrd Skynyrd meets Run-D.M.C.." The song is a genre all to itself fusing elements of rap, heavy metal, folk and southern rock. The song contains samples of The Allman Brothers "Midnight Rider" and the piano break of the Doors "L.A. Woman" in which during the video Joe C. and Gary Coleman duel it out while porn star Ron Jeremy rocks the piano. The song was about how Kid Rock had foreseen his move to Hollywood to become a star. "Cowboy" peaked at 82 on the Billboard Hot 100, No 34 on The Top 40, No 5 on Mainstream Rock Chart and No 10 on the Modern Rock charts. This song was featured for the first promotional commercial for WrestleMania XXV. I have a search that returns the video, so for example, if I search for the word "song" It would return portions of the above text. In a format similar to this: He describes the song as "Lynyrd Skynyrd meets ... The song contains samples of The Allman Brothers "Midnight Rider" ... This song was featured for the first promotional commercial for WrestleMania ... I already have the bold portion done... Link to comment https://forums.phpfreaks.com/topic/134167-filter-text/#findComment-698943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.