Connect to the database { Get information from news forum { get next post in list, if the next post in list is not the last post carry on { if checking for pinned is on, and the post is labeled as pinned, display the post { THE POST } if checking for pinned is off though, and the post isn't inside a topic, display this post THE POST } if its the last post, and the post is a parent post. quit { QUIT LOOP } } Call this function again, but turn off pinned post checking, and get the next post in the list } }