-2

I've been working on my own website for a while and wanted to go ahead and make my own blog type section where I can post things. I've managed to get that done but would like to have an automatically updating 'Recent Posts' list in the sidebar instead of having to manually update the post names and links every time I go to make a new post. Here is what my sidebar looks like right now:

<aside id="sidebar">
    <div id="recent">
        <p>Recent Posts</p>
        <h3><a href="articles/first_post_20140124.html" title="First Post">First Post</a></h3>
        <h3><a href="articles/second_post_20140124.html" title="Second Post">Second Post</a></h3>
    </div>
</aside>

So what I'm assuming I need to do is have some code that looks in the '/articles/' directory, finds the most recent post (all posts are timestamped) and then adds in the file path to the anchor?
I'm pretty new to coding things from scratch as I'm normally on the design side of things, so any help would be much appreciated.

jamezcharazu
  • 5
  • 1
  • 4

1 Answers1

0

In order to access the file system (to find your posts and determine which are most recent) you will probably need some kind of server-side technology. Javascript (and of course HTML5) for example runs on the client's browser and is not touching your server's file-system.

You have to look at what kind of server-side technologies are available to you. For example, can you use PHP, ASP.net, etc? Take a look at where your site is hosted and see what you can find, do a little research, then edit your question accordingly.

Depending on how set you are on this feature this may be more trouble to set up than it's worth but in terms of difficulty, it is not hard to do, and it is a good way to learn the basics of programming.

Laila Agaev
  • 1,782
  • 1
  • 10
  • 19
  • I'm currently just hosting it locally on a NAS (Network Attached Storage) but I could easily set up a bought domain to go to it. It's not a neccesity, but like you say, I feel that it can't be too hard and may help me learn how to do things ... If I could work out where to start with it! I'm not all that familiar with PHP, but am told it is fairly easy to pick up especially if you have prior knowledge of Javascript etc (which I do) - can I use that then? – jamezcharazu Jan 24 '14 at 22:03
  • Here is a useful site that tells you about different server-side technologies and which one to choose. PHP is just one of many, but yes you can use that. Any of the ones below will give you all the power you need. http://www.adobe.com/devnet/dreamweaver/articles/which_serverside_technology.html In terms of how to set it up, you can look it up on this site. Here's a question that should help you run PHP on your local machine without having to get hosting or a domain (unless you want to): http://stackoverflow.com/questions/1678010/php-server-on-local-machine – Laila Agaev Jan 27 '14 at 15:13