BYU-ODH / hlrdesk

https://hlrdesk.hlrdev.byu.edu/
MIT License
0 stars 2 forks source link

St/news box #384

Closed stevethomas19 closed 8 years ago

stevethomas19 commented 8 years ago

This is the new area where people can edit the news box found here.

Things I still need to do:

  1. Add tests.
  2. Make sure that the query in hlr is pulling from the hlrdesk db.
stevethomas19 commented 8 years ago

@trevren11 Good question. To be fully honest I don't understand the purpose of this file. I don't understand the format of the select addcol or even if we are supposed to add the new table here.

webnard commented 8 years ago

Looks good. I haven't played with it—just looked at the code—so you might want to walk someone through its use when you get the chance.

In the future you'll probably want to use the template tag to make the JavaScript work less onerous: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template. Since we're only targeting modern browsers with the possible exception of the calendar, feel free to use any cutting edge features.

stevethomas19 commented 8 years ago

Ok we have an RSS feed that works! When we are ready to implement these changes live (or when there is news in the production db) this is the code to put in news.php at hlr.byu.edu.

<?php

$xml = file_get_contents('http://hlrdesk.byu.edu/rss');

$x = new SimpleXMLElement($xml);

echo "<div id=\"news\">
        <h2>HLR News</h2>";
foreach($x->channel->item as $entry) {
        echo "<div>
        <h3>$entry->title</h3>
        <a href='$entry->link' title=\"Image retrieved from $entry->link\"><img src='$entry->link' alt=\"image representing this news\" /></a>
        <p>$entry->description</p>
        </div>";
}
echo "</div>";
?>

For testing purposes do the following:

  1. Pull the code and npm install
  2. Add news article(s) to the db
  3. ssh to hlr.byu.edu and edit news.php to look like the following code a) instead of 'http://hlrdesk.byu.edu/rss' use your hostname i.e 'http://Stephens-Air.app.byu.edu:8080/rss'
  4. navigate to hlr.byu.edu - you should see your news in the News box on the live site.
webnard commented 8 years ago

The main thing I see is just a potentially inappropriate URL being used for the RSS feed. It likely won't affect anything, but it's worth looking into since it's an easy fix. Once that's done, I see no reason not to go ahead and merge.

webnard commented 8 years ago

Barring the merge conflict, everything LGTM.