Recent Photos


As my first experiment for MT, I’ve tried to incorporate my .Mac photos page into this site. It’s kind of a hack, but it appears to work fairly well.

I used an Open Source PHP HTML parser to parse the menu from my .Mac homepage. I then used a little PHP hackery to reassemble the links into page that could be included into the side menu.

I think that I’ll end up running this page as a nightly cron job, so I don’t tax the .Mac server so heavily.

Here’s the PHP cron code, if you’re interested:

<?php
    // Dumps .Mac Photo Homepage Menu

    include ("htmlparser.inc");
    $parser = HtmlParser_ForURL ("http://homepage.mac.com/srobbin/Menu3.html");
    $fileString = ‘</ul>’;
    while ($parser->parse()) {
        if (($parser->iNodeType == NODE_TYPE_COMMENT) && ($parser->iNodeValue == "<!–NavBarWrapperBegin–>")) {
            while ($parser->parse()) {
                if ($parser->iNodeName == "A") {
                        $attrValues = $parser->iNodeAttributes;
                        $hrefValue = $attrValues[‘href’];
                        if ($hrefValue <> ‘#’ && $hrefValue <> ) {
                                $parser->parse();
                                $fileString = "<li><a href=’$hrefValue‘ target=’_blank’>" . $parser->iNodeValue . "</a></li>\r\n" . $fileString;
                        }
                }

                if (($parser->iNodeType == NODE_TYPE_COMMENT) && ($parser->iNodeValue == "<!–NavBarWrapperEnd–>")) {
                        break;
                }
            }
            break;
        }
    }

    $fileString = "<ul>" . $fileString;
    $newFile = fopen(’somefile.php’, ‘w+’);
    fputs($newFile, $fileString);
    fclose($newFile);
?>

Comments

Comment RSS

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment: