tags:

views:

78

answers:

4

Hi, Guys

I'am a newbie also my language maybe bad, and looking for solution for my learning php code let say i have many page i.e. etc page1.php ... page1001.php each page maybe: inside of page1.php:

$color = "red";
$pages = "two";
$theme = "ocean";
$lang = "eng";
$charset = "ISO-8859-1";
etc (more..)

inside of page2.php :

$color = "blue";
$pages = "two";
$theme = "ocean";
$lang = "it";
$charset = "UTF-8";
etc (more..)

now i need to put the variable of each pages to one page, n just put a simple code in each pages to setting them so next time easily to edit, note I using plain text (flat file)

anybody help me? i give appreciate and say thank you

+1  A: 

You can try to use "include"

tensaix2j
ok thakyou...but how to do that? because the variable maybe different...ok variable i put the to one page let say parameter.php :<?//page1.php$color = "red";$pages = "two";$theme = "ocean";$lang = "eng";$charset = "ISO-8859-1";etc (more..)//inside of page2.php :$color = "blue";$pages = "two";$theme = "ocean";$lang = "it";$charset = "UTF-8";//etc (more..)?>but when i putinclude "parameter.php"; in each page1.php ...page1001.php not always suitable, that possible using array? but how...?
jones
Use a switch on which page to include.
tensaix2j
A: 

or you could use:

require('page1.php');

This will work similarly, but cause an error if the page cannot be located.

see: here

JT.WK
A: 

oh sorry maybe i give wrong explained:

I mean all content in page1.php up to page1001.php above i will move to one page call it as parameter.php so parameter.php become:

<? 
//the value of page1.php 
$color = "red"; 
$pages = "two"; 
$theme = "ocean"; 
$lang = "eng"; 
$charset = "ISO-8859-1"; 
etc (more..)

//the value of page2.php : 
$color = "blue"; 
$pages = "two"; 
$theme = "ocean"; 
$lang = "it"; 
$charset = "UTF-8"; 
//etc (more..) 

//the value of page3.php :
$bla-bla = "bla-bla";
?>

now how to call the value of page1.php also page2.php in parameter.php above? if i using include "parameter.php"; in each page (page1.php up to page1001.php) sometimes not suitable to each of page...

jones
A: 

Judging by your data, you could put your values for a certain page into an associative array such as this:

//Page1.php
$page1Information('color' => 'red', 'pages' => 'two', 'theme = 'ocean');

//Page2.php
$page2Information('color' => 'blue', 'pages' => 'five', 'theme = 'forest');

Then you can include all the pages in your parameter.php file, and call upon the data in any one file by going:

echo $page1Information['color']; 
//Prints out "red"
Tilo Mitra
thank You...it's look nice<? //this file named page1.phpinlude_once "parameter.php";print $page1Information[] ; //this possible to call all value page1.php from "parameter.php file??>
jones
it's not work in my tested
jones