News-Maniac, Making for User Declared Language Set
Posted: Fri Jun 25, 2004 11:11 am
Hey guys.
I am running news-maniac, a smarty driven news posting system. It doesn't seem to use pair but has many functions set aside. Anyway. I'll show you a picture:

Ok, well this is the basic root for my system. You can see those Flags there, that Im going to have the user click, whichh should change the language of the site.
This news-maniac system already has built in internationization. The way it works is it has a big list of variables for anything that can be hotswaped is in a file called german.php, or english.php. Each with a massive list of variables that it swaps into place. These variables are called apon by the varible $lang.
Ok.. So Index.php loads. Which loads global.php, this file looks like this:
So this loads config, and uses getconfig to get the settings from the database. It pulls from the database $config->["language"], which is default 'english'. So just before
require ("./lang/".$config["language"].".php");
if you are to put
$config["language"] = "german"; it will pass german and then use the GERMAN.PHP file of variables to fill in the locations on the site.
So instead of putting that there, I would put say:
I figured something like this should work. But everything I try either gives me a blank white page (error), or it WILL work with putting index.php?lang=english, but index.php alone will be blank. I've never been able to make index.php?lang=german work right either.
If I have this link .php?lang=german, I want it to change the $config['language'] varable for the entire site for that session. config is not an object, so i dont know how to code this.. please help
I am running news-maniac, a smarty driven news posting system. It doesn't seem to use pair but has many functions set aside. Anyway. I'll show you a picture:

Ok, well this is the basic root for my system. You can see those Flags there, that Im going to have the user click, whichh should change the language of the site.
This news-maniac system already has built in internationization. The way it works is it has a big list of variables for anything that can be hotswaped is in a file called german.php, or english.php. Each with a massive list of variables that it swaps into place. These variables are called apon by the varible $lang.
Ok.. So Index.php loads. Which loads global.php, this file looks like this:
Code: Select all
<?php
<?php
/**
* global.php
*
* Initializing main functions and settings
*/
require ("./include/config.php");
require ("./include/class.db.php");
$db = new db;
$db->connect();
require ("./include/functions.php");
$config = getConfig(); //* Here is gets the varibles from database
require ("./lang/".$config["language"].".php"); //* here is where is tells what language file to load
require_once ("./smarty/Smarty.class.php");
require ("./include/javascript.php");
$smarty = new Smarty;
$smarty->compile_dir = "./cache/";
$smarty->template_dir = "./templates/";
$smarty->use_sub_dirs = 0;
$smarty->debugging = $config["debugging"];
$smarty->assign('encode', $config["encode"]);
$smarty->assign('page_title', $config["title"]);
$smarty->assign('javascript', $javascript);
$smarty->assign('lang', $lang);
?>
?>require ("./lang/".$config["language"].".php");
if you are to put
$config["language"] = "german"; it will pass german and then use the GERMAN.PHP file of variables to fill in the locations on the site.
So instead of putting that there, I would put say:
Code: Select all
<?php
if(!isset($_REQUEST['lang'] == 'german'
{
$config["language"] = "german";
{
elseif
{
$config["language"] = "english";
}
?>If I have this link .php?lang=german, I want it to change the $config['language'] varable for the entire site for that session. config is not an object, so i dont know how to code this.. please help