Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

  1.  
    Hey, is there any way to make the search result URL cruft free? or am I missing something?
  2.  
    any thoughts?
    •  
      CommentAuthorsidtheduck
    • CommentTimeFeb 24th 2009
     
    are you wanting them cruft free for a reason? Just curious because it is not currently set up and has not been requested as of yet. I can look into it for you though.
    • CommentAuthorayportfolio
    • CommentTimeFeb 24th 2009 edited
     
    Hi, :)

    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]
    •  
      CommentAuthorkimparsell
    • CommentTimeFeb 24th 2009
     
    ayportfolio:

    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.
  3.  
    Very cool Kim, I'll check that out tonight and see what I can do.
  4.  
    This is it so far. I'm sure it could be improved, especially where the arrays are manipulated.

    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>

  5.  
    ok, this went off on a tangent... Any suggestions on how to make the search url cruft free?
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 3rd 2009
     
    ayportfolio,

    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).
  6.  
    thanks... I appreciate it.
    • CommentAuthordime
    • CommentTimeMar 6th 2009
     
    I don't think that this should be done, at least not as default behavior. If you want to include it in core, then it should be separate option from default cruft free URLs.

    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.
  7.  
    I'd just like to know how, an added feature like this would be icing on the cake.
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 11th 2009
     
    dime,

    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.
  8.  
    I know google does index $_GET.
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 17th 2009 edited
     
    Yes, I know that too. :D I was asking if it grabs $_POST variables as well because if so, then I have a solution that would hopefully make everyone happy. :P
  9.  
    :)

    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.
    • CommentAuthordime
    • CommentTimeMar 19th 2009
     
    It 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.