The free hosting service I use doesn't allow MySQL, and I want to make a blog page that would at least know how to separate the data to multiple pages. I got an idea to store all the posts (with html tags) in a txt file and have a script that reads the required portion of it (based on the page number) and putting it into the html file that the user loads (the posts are counted using a special tag that the script will search for).
I'm a complete php noob though and my attempts so far have been unsuccessful. What I'd like to know is: is it possible, is php the right language for it, and do you have some advice on how to get it done, or at least know a good tutorial or php functions/syntax archive.
I searched the web for php information and composed a short script, but it doesn't do anything and I don't know if the problem is syntax related or lack of knowledge about the various nuances of the functions I used.
Here it is in case you want to take a look:
Code:
<?php
$file = fopen("blogdatabase.txt", "r");
&page=0;
$counter=$page*10;
while(!feof($file) && $counter!=$page*10+1){
$temp=fgets($file);
if ($temp=="(post)")
$counter++;
}
fclose($file);
echo $temp;
?>
Thanks in advance.
|