Open & Search a .txt file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Open & Search a .txt file

Post by bla5e »

I am working on making a CMS for my personal site for easier editing. I have a flash banner/menu that can be edited with a text file (contents posted below) and I want to beable to edit the text file from the CMS.
 
&name=TITLE 1
&name2=TITLE 2
&name3=TITLE 3
&button1=MENU ITEM 1
&button2=MENU ITEM 2
&button3=MENU ITEM 3
&button4=MENU ITEM 4
&rep=replay
&url1=MENU ITEM 1 LINK
&url2=MENU ITEM 2 LINK
&url3=MENU ITEM 3 LINK
&url4=MENU ITEM 4 LINK
&iurl1=ICON 1 LINK
&iurl2=ICON 2 LINK
&iurl3=ICON 3 LINK
&enddata=1
 
I want to make the page for editing the file in a form with a text field for each line. Inside the text field i want what is already declared for the variables, but not the variables show (layout example: Menu Item 1: [TEXT FIELD WITH "Menu Item 1"] \n Menu Item 2: [TEXT FIELD WITH "Menu Item 2"])

I know how to rewrite the file, but I am having a hard time getting the variables not to be shown.
If someone wants to write the whole script, I thank you very much!! :mrgreen: but pointing me to the right function might be good enough
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Open & Search a .txt file

Post by pickle »

Just set the "name" of the textfield to the variable name, like this:

Code: Select all

<input type = "text" name = "button1" value = "MENU ITEM 1" />
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Re: Open & Search a .txt file

Post by bla5e »

I understand how to do that, but I want it to be whatever is already set.

Example:
Menu Item #1 - Nothing Set [&button1=MENU ITEM 1] yet:

Code: Select all

  1. <input type = "text" name = "button1" value = "MENU ITEM 1" />
Menu Item #1 - Set as 'About' [&button1=About]:

Code: Select all

  1. <input type = "text" name = "button1" value = "About" />
Menu Item #1 - Set as 'Main' [&button1=Main]:

Code: Select all

  1. <input type = "text" name = "button1" value = "Main" />
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Open & Search a .txt file

Post by pickle »

file() may be able to help you read the contents.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Open & Search a .txt file

Post by jackpf »

Just out of curiosity...could you not use a database for this?
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Re: Open & Search a .txt file

Post by bla5e »

jackpf wrote:Just out of curiosity...could you not use a database for this?
dont know how to get flash files to read a mysql db
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Open & Search a .txt file

Post by jackpf »

Oh sorry - I didn't notice it was in flash. Ignore me ^^
Post Reply