1. What would it be like to walk thirty dogs?

    Posted on: November 14, 2010

    Ruff!

    I’ve been working on this site, thirtydogs.com, for some time now. Thirtydogs is basically a place where you can find and share ideas for somewhat unconventional things to do with your time.

    Ideas on thirtydogs.com can range from Start an ant farm to Roast wieners or marshmallows over the stovetop element.

    I built Thirtydogs using the PHP framework Codeigniter. It’s a great, lightweight framework. It had what I needed without a bunch of extra crap.

    Anyways, go check it out and make sure to check back often. There’s a lot of features sitting at the 90% mark that I should be rolling out over the next couple of months. We’re also planning on tightening up the design. I think the most interesting thing will be to see what this site evolves into as a community develops around it. Hopefully some creative people dig the site and we can build a nice big database of ridiculous ideas.

    Remember, waste your time creatively.


  2. Playing with FrogCMS (Part 7: My Conclusion)

    Posted on: March 12, 2010
    (more…)

  3. Playing with FrogCMS (Part 6: User Management)

    Posted on:
    (more…)

  4. Playing with FrogCMS (Part 5: The Blog)

    Posted on:
    (more…)

  5. Playing with FrogCMS (Part 4: The Theme [continued...])

    Posted on:
    (more…)

  6. Playing with FrogCMS (Part 3: The Theme)

    Posted on:
    (more…)

  7. Playing with FrogCMS (Part 2: The Plan)

    Posted on:
    (more…)

  8. Playing with FrogCMS (Part 1: Installation)

    Posted on:
    (more…)

  9. PHP: unserialize() Error at offset… (simple solution)

    Posted on: November 13, 2009

    Here’s what I was trying to do:

    • serialize an array on one page (PHP: serialize($array))
    • print out the results using echo or print_r
    • grab the serialized data from another script using file_get_contents
    • unserialize that array so I could go about my business

    but I kept getting this error:

    unserialize() [function.unserialize]: Error at offset 0 of 3457 bytes

    I looked around and couldn’t find a simple a solution. I’m sure this error can occur in other ways, but I was trying with the simplest of arrays:

    Array("Ryan" => "Bosinger");

    My problem was that my echo statement was throwing some whitespace in there. That’s all. This fixed it:

    $data["search_results"] = file_get_contents("http://localhost/sphider/search.php?query=" . $search_for . "&search=1&start=" . $start);
    $result_string = trim($data["search_results"]);
    $result_array = unserialize($result_string);

    Basically, try trimming the whitespace before unserializing. Hope that helps!

    Also, I was using Codeigniter but I really don’t think that has anything to do with it.


  10. Grab RSS feed with PHP

    Posted on: September 29, 2009

    I would like to share a PHP function for writing out parts of an RSS feed to a page. I used this in the redesign of ryanbosinger.com to show the latest three posts of this blog.

    To use it, just call the function where you’d like it show up like so:

    <?php getFeed("http://ryanbosinger.com/blog/feed", 3); ?>

    The second parameter is the amount of posts to show. It will write out as an unordered list. You can choose to write out different parts of the feed by changing: $x->channel->item[$i]->[name-of-feed-tag]

    <?php
    function getFeed($feed_url, $posts_to_show) {
     
    	try 
    	{
    		$content = file_get_contents($feed_url);
    		$x = new SimpleXmlElement($content);
     
    		echo "<ul>";
     
    		$i = 0;
     
    		while ($i < $posts_to_show){
    			echo "<li><a href=\"" . $x->channel->item[$i]->link . "\" title=\"" . $x->channel->item[$i]->title . "\" target=\"_blank\">" . $x->channel->item[$i]->title . "</a></li>";
    			$i++;
    		}
     
    		echo "</ul>";
     
    	} 
    	catch (Exception $e) 
    	{
    		echo "<p>The blog feed doesn't seem to be available at the moment...</p>";
    	}
    }
    ?>