eg:
url: ?page=welcome
Code: Select all
<?php
$page = $_GET['page'];
// array holding text to be replaced
$text['welcome']['{section.bla}'] = "bla bla bla";
$text['welcome']['{section.foo}'] = "foo foo foo";
$text['welcome']['{section.bar}'] = "bar bar bar";
$string = "{section.bla}{section.foo}{section.bar}";
//not correct!!! but how then???
print str_replace($text[$page][?], $text[$page][?][], $string);
?>in practice $string is an html template 'got' with file_get_contents()
and the array is used to hold diff. language versions of the same site.
so i want it to search the value of the second dimention assoc_key and replace it with its contents to $string.
i hope this makes sence.
Many thanks in advance,
Paolo
PS: I have tried this with foreach() and for() loops, but to no avail, on an entire document (file_get_contents()) and on line by line (fopen(),fgets(),feof(),fclose())