arabic languages

A place to discuss and receive support for the Web Auction application.

arabic languages

Postby chadifa » Tue Jan 08, 2008 6:28 am

thx steve for help but also this change of language will be only in the admin part how to let the user to choose his languages?
and how to change the light to left alignement for each languages?
and have another question i want to count the user online on the site but i don't know where to put my php script to count user that have success to logged in
thx again
chadifa
 
Posts: 7
Joined: Thu Jan 03, 2008 12:41 am

Postby shannah » Tue Jan 08, 2008 10:32 am

how to let the user to choose his languages?

Not sure why the language selector is not showing up. You can always change the language to a desired language by adding -lang=xx where xx is the language code of the language to change to.
So you could just add a link to
index.php?-lang=en
to change to english
or
index.php?-lang=fr
to change to french
etc...

how to change the light to left alignement for each languages?


This can be done with CSS:
http://www.w3schools.com/css/pr_text_direction.asp

So what you need to do is add a block with css that depends on the user's chosen language.
You can always obtain the user's current language by:
Code: Select all
$app =& Dataface_Application::getInstance();
$app->_conf['lang'];  // something like 'en' or 'fr'


So you could modify the custom_stylesheets block in the ApplicationDelegate class to handle this case:

Code: Select all
function block__custom_stylesheets(){
    echo '';
    $app =& Dataface_Application::getInstance();
    switch ( $app->_conf['lang'] ){
        case 'ar': 
            echo '';
    }

}


i want to count the user online


For this you'll probably want to create a table that keeps track of the users who have accessed the script in the past X number of minutes (e.g. 5 minutes). You'll want to store:
1. username (unique)
2. IP address (unique)
3. timestamp

An appropriate place to add code for this would be in the getPreferences() method in the application delegate class because it is executed on every request after the user authentication has been handled.

you might do something like:
Code: Select all
$user =& getUser();
mysql_query("delete from online_users where `username` = '".addslashes(getUsername())."' or `ip_address` = '".addslashes($_SERVER['REMOTE_ADDR'])."' or `timestamp` < '".(time() - 300)."'", df_db());

mysql_query("insert into online_users (ip_address,username,`timestamp`) values ('".addslashes($_SERVER['REMOTE_ADDR'])."','".addslashes(getUsername())."','".time()."'", df_db());



Then you could always access the number of users online with:
Code: Select all
$res = mysql_query("select count(*) from online_users", df_db());
list($num) = mysql_fetch_row($res);
echo $num; // The number of users currently online


more or less..
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Web Auction Discussion

Who is online

Users browsing this forum: No registered users and 13 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved