Jump to content

heisje

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Friesland, Netherlands - Athens, Greece

heisje's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. . ken, [b]many thanks indeed[/b] this is exactly what is needed. a simple and nice solution !! - and wonder now why I did not come up with this myself after trying so long? well . . . . . I hope this will also be of help to somebody else who will need to do the same thing in the future. (I searched extensively in past posts and could not find something similar before). thanks again to [b]ken[/b], and thanks also go to [b]jvrothjr[/b] and to [b]barry[/b] (barand) who contributed alternative ideas. all the best to this wonderful community, dedicated to solving problems. heisje .
  2. . many thanks ken, I see what you mean unfortunately this solution will not work because the $var in my example can be defined only within the script (and are actually different from page to page) - while the text.txt file is a "control" file only, for the 10,000 pages, intended to control how many times and which $var are included in $text. for example: $text = '$var1 $var2 $var1 $var3'; or $text = '$var1 $var1 $var1'; or $text = '$var3'; any ideas? thanks, heisje .
  3. . many thanks, ken I tried <? $var1 = "one"; $var2 = "two"; $var3 = "three"; $text = include('text.txt'); echo $text ?> with contents in text.txt $var1, $var3 but the output is: $var1, $var31 and not: one, three as expected. certainly I am doing something wrong - because apparently you did not mean what I have done by suggesting the use of include() clarification? thanks, heisje .
  4. . I shall try to describe the request in greater detail: Suppose that I have 10,000 php pages that already contain the script: [code]<? $var1 = "one"; $var2 = "two"; $var3 = "three"; $text = "$var1, $var3"; echo $text ?>[/code] output is: one, three for all 10,000 pages Now, suppose that I want to have the ability to change the output of all those 10,000 pages all at the same time by setting the value of $text. One time I may want $text = "$var1, $var3"; Another time I may want $text = "$var3, $var2"; etc. So, if I have an external text.txt file which I can change to $var1, $var3 - or var3, $var2 - or anything I want, then all the 10,000 pages will print the same thing accordingly. It would be fine if the following worked, but of course it does not: [code]<? $var1 = "one"; $var2 = "two"; $var3 = "three"; $text = file_get_contents('text.txt'); echo $text ?>[/code] to insert ex. $var1, $var3 and specify $text = "$var1, $var3"; but this just prints: $var1, $var3 and not : one, three as intended. I hope this is a bit more clear. thanks, heisje .
  5. . many thanks, but I do not get the point: where is the external text file with the variables? and how are they inserted in the script? maybe my question was not very clear: there exists an external text file specifying which variables shall determine $text: for example: text.txt with contents $var1, $var3 tell the script which variables to use for $text. need to read the text file and insert these variables, and get the script to output the text: one, three this is the question. thanks, heisje ..
  6. . have been trying all sorts of ideas to solve this, but nothing has worked - so here I come: for this simple script: [code]<? $var1 = "one"; $var2 = "two"; $var3 = "three"; $text = "$var1, $var3"; echo $text ?>[/code] output is: one, three what is wanted: to get the part "$var1, $var3" from an external text file, and have the script output determined according to what is specified in the text file, in this case the text file contents would only be: $var1, $var3 but could also be $var3, $var2 and then the output would be: three, two thanks in advance for any ideas. heisje .
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.