Plogger Support Forum - search.php cruft free Thu, 28 Mar 2024 10:10:01 +0000 http://www.plogger.org/forum/ Lussumo Vanilla 1.1.10 search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9915#Comment_9915 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9915#Comment_9915 Sat, 21 Feb 2009 10:06:41 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9951#Comment_9951 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9951#Comment_9951 Mon, 23 Feb 2009 23:13:26 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9952#Comment_9952 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9952#Comment_9952 Tue, 24 Feb 2009 02:54:01 +0000 sidtheduck search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9954#Comment_9954 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9954#Comment_9954 Tue, 24 Feb 2009 08:49:23 +0000 ayportfolio
I Thought a cruft free search would be cool to have. The search could actually be used for so much more like displaying categories that didn't exist previously. This was going to be a surprise but I'm working on a tag cloud for plogger that I want to give to the community here. I'm still working on it, but basically, I'm trying to pull random non-high frequency words (interesting words) that are repeated at least 2 times from the "description" column in the "plogger_pictures" table and place them in a tag-cloud format that links each word to search.php via the search string. So far, I'm having trouble with my query results. Anyways, I thought it would be cool if the search feature was cruft free to put the icing on the cake. But, I honestly don't understand how making cruft free urls works. I tried changing the .htaccess file like the below, but had bad results. RewriteRule ^.*$ search.php?path=%{REQUEST_URI} [L]]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9956#Comment_9956 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9956#Comment_9956 Tue, 24 Feb 2009 09:03:24 +0000 kimparsell
Are you using the latest SVN version when developing your tag cloud? If not, then you might want to check out a copy and work with that, as that is the codebase we are currently developing.

There is already a plog-tag-functions.php file in /plog-includes/ that was written a few years ago that you might check out as well - it may help you tie your work into Plogger a bit easier, and possibly help us get proper tagging implemented into the codebase a bit quicker. Currently, proper tagging implementation is planned for the 2.0 milestone.

You might also check out the discussion in this Trac ticket to see if there's anything there that might help you while developing this.]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9959#Comment_9959 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9959#Comment_9959 Tue, 24 Feb 2009 16:14:48 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9962#Comment_9962 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=9962#Comment_9962 Wed, 25 Feb 2009 02:59:16 +0000 ayportfolio
I'd still love to figure out the cruft removal.



<div align="center">
<div class="tag_cloud" style="width: 300px; font-family: Arial, Helvetica, sans-serif; text-align: justify;">
<?php
// options /////////////////////////

// database connect

$myserveris = "localhost";
$myusername = "username";
$mypassword = "password";

$mydatabase = "database";
$mytable = "plogger_pictures";
$mycontentcolumn = "description";

// search url
$mysearchurl = "http://www.yourdomain.com/plogger/?level=search&searchterms=";

// maximum number of words to display
$mynumberofwords = "50";

// random font size
$minFontSize = "8";
$maxFontSize = "35";

// scroll down to banned words to remove common words

// END OPTIONS ////////////////////////////////////////////////////////////////////

////////////////////////////////
// remove odd ball characters //
////////////////////////////////
function normalizeString ($s = '')
{
$str = htmlentities($s);
$str = preg_replace("/(&)([a-z])([a-z]+;)/i", '$2', $str);
$str = preg_replace("/\s+/i", ' ', $str);
$str = trim($str);
return $str;
}

////////////////////////////////////////////
// remove banned and high frequency words //
////////////////////////////////////////////
function removeCommonWords($input){
$commonWords = array('a','the','I','is','not');
return preg_replace('/\b('.implode('|',$commonWords).')\b/','',$input);
}

//////////////////////
// randomize arrays //
//////////////////////
function randomize_array($array)
{
$rand_items = array_rand($array, count($array));
$new_array = array();
foreach($rand_items as $value)
{
$new_array[$value] = $array[$value];
}
return $new_array;
}

//////////////////////
// connect to mysql //
//////////////////////
mysql_connect("$myserveris", "$myusername", "$mypassword") or die(mysql_error());
mysql_select_db("$mydatabase") or die(mysql_error());
$query = "SELECT $mycontentcolumn FROM $mytable WHERE $mycontentcolumn LIKE '%'";
$result = mysql_query($query) or die(mysql_error());
$countedrows = mysql_num_rows($result);

//////////////////////////////
// create arrays from query //
//////////////////////////////
$thiscount=0;
while($row = mysql_fetch_array($result)){
$loremA[] = $row[0];
$thiscount++;
}

///////////////////////////////////
// make query row results random //
///////////////////////////////////
$loremB = implode(" ",randomize_array($loremA));

// combine the arrays and make all the words random
$loremC = explode(" ",$loremB);
$loremD = implode(" ",randomize_array($loremC));

// clean the words....
$loremE = normalizeString(stripslashes(strip_tags(removeCommonWords($loremD))))." ";

///////////////////////////
// create the cloud .... //
///////////////////////////
$loremipsum = explode(" ",$loremE);
$wordcount = 0;
foreach($loremipsum as $value) {
echo "<a style=\"font-size:" . rand($minFontSize,$maxFontSize) . "px; text-decoration: none;\" href=\"".$mysearchurl.$value."\">".$value."</a> ";
if($wordcount==$mynumberofwords-1)
{
break;
}
$wordcount++;
}
?>
</div>
</div>

]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10032#Comment_10032 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10032#Comment_10032 Mon, 02 Mar 2009 13:32:35 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10037#Comment_10037 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10037#Comment_10037 Tue, 03 Mar 2009 12:51:09 +0000 sidtheduck
I've created a trac ticket so the development team will keep this in mind as we go along. It will most likely be released in a future release (I don't necessarily have any time right now to look into this very much).]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10038#Comment_10038 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10038#Comment_10038 Tue, 03 Mar 2009 16:45:43 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10066#Comment_10066 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10066#Comment_10066 Fri, 06 Mar 2009 16:03:38 +0000 dime
Why? Because search should be done through queries, all search engines use it like that and other scripts as well. For example, this way you could see in statistic (or logs) what are people searching on your site and that will give you a lot informations about their interests. In Google Analytics there is option in Content/Site Search to see what people searched, on what pages they entered queries, did they refined queris, did they left after that etc. I use that feature on Plogger installation and it couldn't be used with cruft free URLs.

One thing that should be done (at least as option) is to put <meta name="ROBOTS" content="NOINDEX,FOLLOW" /> in head of page. On my Plogger site, search engines started to index a bunch of this search results pages and page juice was flowing to it. After I made this addition, they stoped and only indexed valuable pages.]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10087#Comment_10087 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10087#Comment_10087 Mon, 09 Mar 2009 16:04:52 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10099#Comment_10099 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10099#Comment_10099 Wed, 11 Mar 2009 19:02:43 +0000 sidtheduck
I haven't looked into Google Analytics at all. Do you know if it checks $_POST queries as well as $_GET queries? If so, I may have a solution that uses cruft-free searches (for paging links, etc.) but uses a standard post method form for the searches (i.e. not cruft-free if you do a specific search from the search form). I may need to look into this some more, but it would be great if you could provide your insight into this behavior as well.]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10166#Comment_10166 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10166#Comment_10166 Tue, 17 Mar 2009 10:30:42 +0000 ayportfolio search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10167#Comment_10167 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10167#Comment_10167 Tue, 17 Mar 2009 11:49:58 +0000 sidtheduck search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10171#Comment_10171 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10171#Comment_10171 Tue, 17 Mar 2009 12:59:24 +0000 ayportfolio
I think maybe if search.php is sent to the browser as ($_POST) http://url/search/ with no extra parameters (?var=foo&var=foo or /foo/var/), then the spider will see that particular page differently every time it comes to index it. And the spider will probably wind up in some sort of weird loop and quit if it "thinks" it repeatedly visiting the same page. I'm not entirely 100% sure though. Definitely something cool to learn here.]]>
search.php cruft free http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10191#Comment_10191 http://www.plogger.org/forum/comments.php?DiscussionID=2515&Focus=10191#Comment_10191 Thu, 19 Mar 2009 10:03:20 +0000 dime uses get (at least I think this is get).

But Google Analytics wasn't point of my post. Point was that this shouldn't be default behavior if it is implemented and that it should be separated in something labeled as "advanced" so that users who use it should know who this thing works. (I have other suggestion which should be also labeled as advanced, which would hopefully document here on forum). I.e. there could be link near that option that point to some documentation page which describes for what it is used for.]]>