Ok, this might sound stupid. But I'm asuming "aid" would be replaced by my filename? (Article ID, I guessed) and I could change .htm to certain other extensions if I wanted to?
EDIT: On looking closer at it - just the " 1 " or the " n " would be replaced with a filename/article number, yes? So according to this script, I should name a file something like
article_1.htm
If i'm right, the next question is this. In this code, it's refering to "index.php"
My articles are will be appearing on a page "articles.php" so I figure I Can just swap out index.php with articles.php no problems. What I want to know is can I pull articles from within a directory called articles? I've tried replacing article with
/articles/article and I've tried also replacing it with the full URL like so
'http://www.paint-zone.co.uk/articles/article_'
EDIT: I've decided that's there's no point in pulling from a directory, instead do as you guys said, call it index and put the articles section IN a directory. Thanks!
Next problem:
I have 3 articles so far, and for some reason, it's not pulling just 1 of them (Called "what.htm"
Any basic ideas as to what could be causeing this? Looking at the code, I can't see anything. I'll post back in a min with the code.
// Begginer menu
// Could be an include if needed
echo '<a href="index.php?aid=what">What is paintball?</a><br />';
echo '<a href="index.php?aid=lesson1goggles">Lesson 1: Goggles</a><br />';
echo '<a href="index.php?aid=lesson2glovesshoes">Lesson 2: Gloves and Shoes</a><br />';
// includeing article
if( file_exists('article_' . $_GET['aid'] . '.htm') ){
include 'article_' . $_GET['aid'] . '.htm';
}
else{
echo 'Choose an article from menu';
}
EDIT: Haha, I simply missed the "article_ " prefix.
Thanks guys! This has work excellently!
EDIT AGAIN: Whoops, I've misentrerpated part of the thread! I don't know how to unmark threads resolved, if it's possible. So I'll ask the question here, if not I'll start a new thread.
From what I can see, you guys are saying I should have my articles call artcile_1.htm etc etc, so that people can't put nasty stuff in to the query. Is their anyway I can do this with words? I intend on having a lot of articles and needing to know what is in each one without opening it up.