CogBlogged Tagged ‘php’

More Code Fun: Reading (or ‘to Read’) List

While I’m on the code doc kick… this one is not mine, but something I applied on my site. A week or so ago I came across (from RSS feeds? nah, I think it was in twitter? maybe a squirrel stepped o my keyboard?) Steph Gray’s Reading: keeping on top of stuff I save, some code he rolled. The way he describes the need rang a resonant bell with me: Like a lot of people, I use services like Google Reader, Twitter, Delicious and Instapaper to help me find and store interesting links to articles, tools, apps or whatever. Personally, when I don’t have time to read it right now, I tend to star an item in Google Reader, ‘favourite’ it in Twitter, or mark it to ‘Read later’ in Instapaper – often five or ten things a day. I also save interesting stuff to Delicious, particularly where I think [...]

PHP Local Time Code

I spent about 15 minutes writing a small PHP function for one of my sites, and then another hour writing it up. What for? Well, let’s back up. If you are running online events where people might come from anywhere, there can always be challenges for getting the right time to people. For our NMC events, while our office is in Austin, we have staff in 3 other time zones, and people in our community from maybe another 14 or more zones on top of that. If I say something starts at 2:00pm Central Time, then it puts it on everyone else to figure out when that is (and I’ve seen event sites where they do not even provide the reference time zone). If were all proper and versatile, we’d use Greenwich Mean Time, since everyone knows their offset, right? (I am -7 what are you?) Most of the time [...]

Updating Web Sites with Google Spreadsheets

I’ve done a handful of web projects this year where it made sense to store data in Google Spreadsheets, and then use a bit of PHP code to make them be dynamically displayed on a web site. In many cases, these are tables of data that are parsed and presented nicely in the web site, but for a few NMC projects, it made sense as a way for a staff person to update data on our web pages w/o having to touch the pages. As a first example, I am cleaning up an older WordPress site I use for logging my running/training; in the past, I kept a spreadsheet on my desktop for keeping a run log and then manually transferred the totals/averages/graphs to my web site by pasting into some text files (they are embedded with a PHP include). It worked, but it did have that tedious manual smell [...]

WordPress Shazam! Your Category is Now a Page

cc licensed flickr photo shared by ElDave The main navigation of most WordPress sites is driven by cycling through all of the content that are WordPress pages– which is nice, but sometimes you have content that you don;t want cluttering the navbar. Or maybe you want to insert something that is not a Page into the navbar. I’ve been amazed that so few people seem to know how to subvert it, and below is a little trick I use when I want to wedge some other kind of WordPress content into the navbar by Pages process. Mostly this is in your HEAD… I mean the header.php file of your templates that generates it as an Unordered List: <div id="nav"> <ul>   <li class="<?php if (is_home()) {echo 'page_item current_page_item'; } ?>">     <a href="<?php echo get_settings('home'); ?>/">Home</a></li>   <?php wp_list_pages('title_li' ); ?> </ul> </div> The first li item creates the Home link, and in [...]

How to Put Anything in Your MediaWiki Pages

Well, “anything” is loosely termed. I run about 6 different MediaWiki sites for the NMC, and I have to remind myself alot that the software is a huge black box (it works super) and I am pretty sure the things I have done tap maybe 8% of what it is capable of doing. One of the limits is the kind of content you can put in the editing pane. Sure you can add additional tags you want to allow, but even a security lazy bum like me is not interesting in allowing any person to add <script> tags in there. Danger, Danger, MediaWiki Robinson! So in prepping some new things for the wiki that we have reset for the 2009 NMC Horizon Project– we don’t delete the old stuff or hide them in edits; each year I migrate content to its own namespace, e.g. http://horizon.nmc.org/wiki/Horizon2007:Main_Page and http://horizon.nmc.org/wiki/Horizon2008:Main_Page. I’d like to [...]