auto-updating site?

Discussion in 'General Business' started by revolution13, Mar 17, 2008.

  1. #1
    I am looking into possibly starting a couple of these sites but i have no idea on how. I see a few sites listed in the BST section reguarding auto-updating site and would like to own some but made about what I want for a niche. I am just wondering what sorta scripts and what not I need to get them running.
     
    revolution13, Mar 17, 2008 IP
  2. nickswift

    nickswift Well-Known Member

    Messages:
    535
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #2
    RSS feeds - here is one i use for a PHP site

    Web reference
    </span>
    <div class="t11g" id="size">
    <?php
    // Reset a few variables
    $rss_channel = array();
    $item_counter = 0;

    $xml_parser = xml_parser_create();
    xml_set_element_handler($xml_parser, 'startElement', 'endElement');
    xml_set_character_data_handler($xml_parser, 'characterData');
    if (!( $fp = fopen($file, 'r') )) {
    exit('Unable to open XML file.');
    }

    while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
    exit(sprintf( 'XML error: %s at line %d', xml_error_string(xml_get_error_code($xml_parser)), xml_get_current_line_number($xml_parser) ));
    }
    }
    xml_parser_free($xml_parser);

    // Output as XHTML
    ?>
    <?php
    if (isset($rss_channel['ITEMS'])) {
    if (count($rss_channel['ITEMS']) > 0) {
    $feeds_amount = ($feeds_amount == NULL) ? count($rss_channel['ITEMS']) : $feeds_amount;

    $random_entries = array_rand($rss_channel['ITEMS'],$feeds_amount); // Random array values

    for ($y = 0; $y < count($random_entries); $y++) {
    $entry = (is_array($random_entries)) ? $random_entries[$y] : $random_entries;
    if (isset($rss_channel['ITEMS'][$entry]['LINK'])) {
    ?>
    <div class="link"><a href="<?php echo $rss_channel['ITEMS'][$entry]['LINK']; ?>" target="_blank"><?php echo $rss_channel['ITEMS'][$entry]['TITLE']; ?></a></div>
    <br>
    <?php
    }
    else {
    ?>
    <div class="link"><?php echo $rss_channel['ITEMS'][$entry]['TITLE']; ?></div>
    <?php
    }
    ?>
    <div class="description"><?php echo $rss_channel['ITEMS'][$entry]['DESCRIPTION']; ?></div>
    <br>
    <?php
    }
    }
    else {
    echo '<strong>This feed contains no articles.</strong>';
    }
    } ?>
     
    nickswift, Mar 17, 2008 IP