Photo Gallery and News Page with PHP & Flat Text File DB

  • acra
  • Born
  • Born
  • acra
  • Posts: 2
  • Loc: India

Post 3+ Months Ago

I need help in creating a photogallery and News headlines page. The problem lies that i want to use a Flat TXT file as a database and need a admin section to add/edit and delete the entries in the Flat TXT file.

Please help me.

Regards
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • stinger
  • Graduate
  • Graduate
  • stinger
  • Posts: 157
  • Loc: San Jose, CA

Post 3+ Months Ago

Hello!

I would use php to do this. The text will be easy. Have a php admin page that will scan a txt file, then, create a form, put the text into a text box for modifications, and then have a submit button.

When you submit the form, you will use php to overwrite the text file with the new/old/same text from the text box. Easy. . .

Your photo gallery can work with a simple scanning of a directory, or directories.

SAMPLE OF CODE FOR TEXT:

Code: [ Select ]
        if($txtBtn){
    //Create text boxes to display the student text description and name    
        $TheFile = "files/" . $Text . "/" . $Name . ".php";
        $Open = fopen($TheFile, "r");
        if($Open){
        
        
            $Data = file($TheFile);
            for ($n=0; $n < count($Data); $n++){
                $Getline = explode ("\t", $Data[$n]);
            
            }
                print("<input type=checkbox name=tUpdate value=checkbox>check to update text<input type=text size=15 name=textHeader wrap=VIRTUAL value=\"$Getline[0]\"><br>");
                
print("<textarea name=desc wrap=VIRTUAL rows=10 cols=40>$Getline[1]</textarea><br>");
         }//end open        
        
         }//end if student
    
  1.         if($txtBtn){
  2.     //Create text boxes to display the student text description and name    
  3.         $TheFile = "files/" . $Text . "/" . $Name . ".php";
  4.         $Open = fopen($TheFile, "r");
  5.         if($Open){
  6.         
  7.         
  8.             $Data = file($TheFile);
  9.             for ($n=0; $n < count($Data); $n++){
  10.                 $Getline = explode ("\t", $Data[$n]);
  11.             
  12.             }
  13.                 print("<input type=checkbox name=tUpdate value=checkbox>check to update text<input type=text size=15 name=textHeader wrap=VIRTUAL value=\"$Getline[0]\"><br>");
  14.                 
  15. print("<textarea name=desc wrap=VIRTUAL rows=10 cols=40>$Getline[1]</textarea><br>");
  16.          }//end open        
  17.         
  18.          }//end if student
  19.     


This code will read a text file, find a tab in the text file, and print the text before the tab as a header/title of the file, and then print the body of the file. These will be printed into a text box in a form that you can then modify. You must submit a form and then use php to use the values for the submitted data to write to the file.

Have fun!

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 62 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.