perspective

After the days of hacking away at Golden Cheetah and C++ on Windows, doing some html/css/php/js coding is like a breath of fresh air. There is something somewhat comforting about how rigid C++ is…I can quickly find where I’ve messed up, even if it takes me a bit to figure out how to correct my bugs. These interpreted languages have vagueness, but it’s still fun to fire away at them and not have to deal with compiling or linking.

Anyway, I’m working on coding Kara’s new site and am using it as an excuse to learn jQuery. After tediously hacking the DOM in the past this is really easy. There is a download hit for the jQ library, but it’s not much more than a small image. I wonder how it will work on a mobile device…

The design challenge from my perspective is to make the code intelligent enough to speed up content management but not so obtuse that Kara won’t be able to directly edit the pages. In other words, a database driven CMS is overkill here. I also want to allow her to directly link to individual pages, if she needs to show of a particular project. So, it’s in progress, but half the fun is brainstorming the possibilities and making the code work, no? I’ll link the site when it’s live, but for now here’s the jQ code for generating the links on the fly:

$("#sidebar a").click(function(event){
	// this is verbose, but the steps are clear
        // it will create links from the button names
        var label = $(this).text();
	label = label.toLowerCase();
        //replace spaces with underscores 
        label = label.replace(/ /g,'_'); 
        //append the php file extension
        label += ".php";

	// update the html and go
	$(this).attr("href",label);
});

Posted

in

by

Comments

2 responses to “perspective”

  1. nicklally Avatar
    nicklally

    nice, you got my interest!

  2. Robert Carlsen Avatar

    ha! hey nick. this is a nice, but limited solution. i’m sure that there are better ways to handle this, but i figured that the project names wouldn’t change, since they’ve been completed. the code could easily be updated to draw from a attribute in the anchor tag, rather than the visible text within the anchor.

    here’s the current html for the links:
    <a href="#"><p class="heading">About</p></a>

    which would generate <a href="about.php"> when clicked.

Leave a Reply