Page 1 of 1

Open & Search a .txt file

Posted: Wed Jul 29, 2009 9:11 pm
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

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 12:09 pm
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" />

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 3:35 pm
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" />

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 3:47 pm
by pickle
file() may be able to help you read the contents.

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 4:49 pm
by jackpf
Just out of curiosity...could you not use a database for this?

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 9:06 pm
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

Re: Open & Search a .txt file

Posted: Thu Jul 30, 2009 9:24 pm
by jackpf
Oh sorry - I didn't notice it was in flash. Ignore me ^^