WEB code frenzy friday, added RSS and announcement blocks

Discussion in 'OT Technology' started by biawokauns, Jan 31, 2009.

  1. biawokauns

    biawokauns New Member

    Joined:
    Sep 18, 2001
    Messages:
    19,893
    Likes Received:
    0
    Location:
    Republic of Kalifornia
    just some insight into one of my projects. we were having an issue with displaying specific announcements to specific sites. before i had everything version controlled it was easy to pop in, edit the announcement file, and be done. the problem was, i'd be looking at anywhere from 1-2 edits per site, up to 7 sites. kidna a PITA. after I moved the announcements to a common folder, 1-2 edits would display the announcement on every site. the problem we ran into is that we didn't want the announcement to show up on all sites, all the time

    what i ended up doing was adding flags to the config file that would control whether the announcement would show, this time, I added a "site specific announcement" as well. this would not be version controlled, and resides in the virtual directory. eventually, I will move this to my admin panel so it can be dynamically flagged/modified.

    Code:
    // ********************************************************
    // 					announcements
    // ********************************************************
    
    $announcement_site_specific = true;
    $announcement_top = false;
    $announcement_middle = false;
    $announcement_bottom = true;
    
    
    inside each of the pages (index, single view, etc) i'd use somehting like this
    Code:
    <? if($announcement_top || $announcement_site_specific){ ?>
    	<div class="clearer">&nbsp;</div>
    	<? if($announcement_top){ 
    		include_once("$common_path/inc.announcement.header.php"); 
    		echo '<div class="clearer">&nbsp;</div>';
    	}?>
    	
    	<? if($announcement_site_specific){ 
    		include_once("inc.announcement.site-specific.php"); 
    	}?>
    	<div class="clearer">&nbsp;</div>	
    <? } ?>
    

    next up was the RSS feed, I've been wanting to create one to showcase recent uploads (since we have addict users). creating hte feed before seemd like it'd be a PITA to maintain...not anymore thanks to version control :bowdown:

    i was able to bang the code out and test it in a few hours. one of the other reasons was so I could sydincate the content to the facebook pages I am building out :run:.

    this is what we have:
    http://explainthisimage.com/ (should be able to subscribe via firefox/safari)
    http://explainthisimage.com/rss

    but i didn't stop there...i ran the feeds through feedburner, and can pull analytics off of it :bowdown:
    feed://feeds2.feedburner.com/ExplainThisImage-RecentlyAdded

    and the FB page I just set up
    http://www.facebook.com/pages/Explain-This-Image/51772971539

    the best part about this (and I know i keep talking about how it's version controlled), is that once I finished testing and coding I just ran my update script...BOOM, EVERYTIHNG enabled on all the sites :hsd:

    not sure if you guys care, or that makes sense... im tired now :o
     
  2. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,766
    Likes Received:
    6
    great idea for the explain this :bowdown:
     
  3. trev.the.enemy

    trev.the.enemy New Member

    Joined:
    Jun 26, 2006
    Messages:
    10,939
    Likes Received:
    0
    Location:
    Midwest
    became a fan on facebook :o
     
  4. JesterFX

    JesterFX New Member

    Joined:
    Oct 10, 2004
    Messages:
    4,557
    Likes Received:
    0
    Grrr took my sfw pron idea lol. Been wanting to throw something up like that forever just because I love those chops.
     

Share This Page