I am attempting to make a language file so a person who downloads the source code can change the text to there language. How do I get the text from one PHP file to another one?
This is the language.php file.
<?php
session_start();
$_SESSION['home'] = "Home";
$_SESSION['about'] = "About";
$_SESSION['tools'] = "Tools";
$_SESSION['testing'] = "*Testing";
?>
This is the page I want the text to appear on, index.php
<?php
// Start the session
session_start();
?>
<html>
<head>
<title>Testing Session</title>
</head>
<body>
<font size="5">Testing <?php $_SESSION['home'] ?></font>
</body>
</html>
You can save your all data in database and access it anywhere you want. Using session variables for this is not really a good idea... You can also include your current file to the destination where you want to use the same data like:
include 'blah.php';
You need to print the result of session variable 'home' like this
<?php
// Start the session
session_start();
?>
<html>
<head>
<title>Testing Session</title>
</head>
<body>
<font size="5">Testing <?php echo $_SESSION['home']; ?></font>
</body>
</html>