Page 1 of 1

How do I specify the location of a variable to be written to

Posted: Mon Jul 28, 2003 8:18 am
by mesz
How do I specify the location of a variable to be written to:
my continuing and never ending search to prove you do not need SQL to build a decent forum continues....
I can now create new files ( writen to a directory ), write content to these files, write the file names to a list, and hyperlink from this list to the contents of these files....
now here is the problem.
I do not have a howI would go about formatting the contents of this newly created file.
ie

Code: Select all

<?PHP
$data = file('list.dat');
$data = array_reverse($data);
foreach($data as $element) {
    $element = trim($element);
    $pieces = explode("|", $element);  
	echo "<a class='link3' href="http://www.distortedmedia.co.uk/test/test1/$pieces[1]">$pieces[1]</a>";

}

?>
How do I read the $pieces variable into a location of my choosing.

I have been using <a name="target"></a> and appending #target to the end of the link, and I have been trying target="_self" but to no avail, only an unformatted new page opens up.

Posted: Mon Jul 28, 2003 9:12 am
by Stoker
There are already several forums out there based on flatfiles, and they all have one thing in common; If there are more than a few thousand posts and users, they waste a lot of resources and are very slow, especially when it comes to searching and things as pulling up "posts since last visit" when the last visit was 3 months ago and there is 10K new posts..

If you are going to use flat files, why not use an abstraction layer? Like ADOdb can use dbase or berkely files I believe, or just use them directly yourself..
SQLite is sort of a flatfile thing as well, just "abstracted" by a library that takes care of the indexes, logic and SQL use and speeds things up quite a bit..

To extract variables from one location into current scope (symbol table) use extract..

Posted: Mon Jul 28, 2003 9:20 am
by mesz
Cheers for the reply - I'll begin looking at extract...
as for the flatfile thing, this came about because of an argument with my host about mySQL.
It is now become a mission to build the thing...
I'm aware it will not be much cop; everywhere I turn I'm told this...but like Everest it is there as a challenge...

Posted: Mon Jul 28, 2003 11:41 am
by Query
You may want to go to http://www.w3schools.com and look at their XML school. XML can let you define what goes where and employs a simple to understand 'tree structure'. Could be a good starting point and PHP provides decent XML support letting you specify how data is treated as it comes back out of the file.

Regards

-Q

Posted: Tue Jul 29, 2003 3:05 am
by mesz
Cheers Query - I shall do that soon ( and if I remember come back and let you know how I got on! ).