Page 1.txt, 3.txt... insert new 2.txt if prev' 2.txt del'd?

Frequently asked questions.

Page 1.txt, 3.txt... insert new 2.txt if prev' 2.txt del'd?

Postby HairyFish » Wed Feb 15, 2012 12:23 pm

Hi,

This is put under FAQ, although probably not frequently asked, it wasn't so much of a problem either.

OK, so I am new to this system, and new to web site building in general.
Smiffy kindly got me sorted, and fixed the issue with the dumbness that is my ISP.

Starting from scratch, I create a new page, call it "home". This will get saved in .../datastore/pages/ as 1.txt.
Create a second page, call it "about". This gets saved in .../datastore/pages/ as 2.txt
Create a third...

Now, if I delete page "about" (because I made an utter pigs ear read: messof it), the text file "2.txt" gets deleted from the .../datastore/pages/ directory.
When I now create a new page, and want to call it "about", or anything else for that matter, it works fine, but appears as another higher number than the last page ever created. In this case, it appears as "4.txt".


This doesn't seem to cause any issues as far as the site working, but perhaps it may get messy once lots of pages are loaded.
Can I create a new page, in the gap of number sequence, or re-organise those number .txt files?

(I had a look at a couple of files, which mentioned reference to a number and the title, and I made an edit (but kept a backup of the data) and the whole place got all messed up. The admin console was further down with loads of random stuff written above, and the site was a similar story. I copy and pasted the backup back in, and it's fine now.)
I think my level of coding ceased when we stopped using cassettes to load our software. RIP Commodore C64.
HairyFish
 
Posts: 10
Joined: Mon Feb 13, 2012 5:53 pm

Re: Page 1.txt, 3.txt... insert new 2.txt if prev' 2.txt del

Postby Adminer » Wed Feb 15, 2012 8:32 pm

HairyFish wrote:Hi,
Starting from scratch, I create a new page, call it "home". This will get saved in .../datastore/pages/ as 1.txt.
Create a second page, call it "about". This gets saved in .../datastore/pages/ as 2.txt
Create a third...
Now, if I delete page "about"


IMHO, it's the best solution with flat database files. No mistakes - and the files counter is long...;-)
You can see about it using my decoder.php file (upload this to the datastore folder and set chmod 777) - its a file to analize, how "the tabel" with "conections" -> database - flatfiles works.

Code: Select all
<?php
//// debuger   ////
   function pr($str){
        echo('<pre>');
        echo '$str: ';
      print_r($str);
        echo('</pre >');
        $d = debug_backtrace();
        echo $d[0]['file'] . '<br />Line: <b>' . $d[0]['line'] . '</b>';
        echo '<hr />';
   }
///////////////
  $data = file("razor_data.txt");
  $data = stripslashes($data[0]); // catches it in some message above
  $postData = unserialize($data);
     extract($postData, EXTR_OVERWRITE);
   pr($postData);
?>


I know, that there is another problem with delete infobars - they are still in razor_data.txt, and are deleted after upgrade with one single new infobar - but not so important.

Regards
Adminer
 
Posts: 578
Joined: Wed Apr 08, 2009 9:52 pm
Location: Poland


Return to FAQ's

Who is online

Users browsing this forum: No registered users and 1 guest

cron