14-Aug-2012, 07:38 AM
This is the community forum. For a developer response use the Client Area.
13-Sep-2012, 09:39 AM
Good job Pier.. Thanks v.m.
I am in the same situation, and by chance, also unse the same variable name $lang storing the ISO code.
I was willing to modify directly the /includes/classes/settings.php to replace directly the $cmtx_settings->language_frontend value returned, when I stopped into your solution.
One issue I continue having is, how to deal with different languages, when use the questions feature, instead of the recapcha ( because its is more user friendly ).
I am searching where are stored the questions, in order to find the way to solve this.
I am in the same situation, and by chance, also unse the same variable name $lang storing the ISO code.
I was willing to modify directly the /includes/classes/settings.php to replace directly the $cmtx_settings->language_frontend value returned, when I stopped into your solution.
One issue I continue having is, how to deal with different languages, when use the questions feature, instead of the recapcha ( because its is more user friendly ).
I am searching where are stored the questions, in order to find the way to solve this.
13-Sep-2012, 01:14 PM
OK. I did it..
I added a new indexed column "lang" to the table {cmtx_prefix_}questions.
Then exported the english questions, and edited the file, with the new spanish questions. ( Must to remove the mention of the id, coz it is auto-incremented ), and executed the insert of the new rows.
Finally added the following code to the script {commentics_path}/includes/template/form.php to filter the query of questions ($cmtx_question_query) by language.
------------------------------
<?php if(isSet($_GET['lang'])){
$lang = $_GET['lang'];
}else if(isSet($_SESSION['lang'])){
$lang = $_SESSION['lang'];
}else if(isSet($_COOKIE['lang'])){
$lang = $_COOKIE['lang']; }
else{ $lang = 'en'; } // Default language as English or the one u prefer
?>
<?php $cmtx_question_query = mysql_query("SELECT * FROM `".$cmtx_mysql_table_prefix."questions` WHERE `lang`='".$lang."' ORDER BY Rand() LIMIT 1"); ?>
------------------------------
I added a new indexed column "lang" to the table {cmtx_prefix_}questions.
Then exported the english questions, and edited the file, with the new spanish questions. ( Must to remove the mention of the id, coz it is auto-incremented ), and executed the insert of the new rows.
Finally added the following code to the script {commentics_path}/includes/template/form.php to filter the query of questions ($cmtx_question_query) by language.
------------------------------
<?php if(isSet($_GET['lang'])){
$lang = $_GET['lang'];
}else if(isSet($_SESSION['lang'])){
$lang = $_SESSION['lang'];
}else if(isSet($_COOKIE['lang'])){
$lang = $_COOKIE['lang']; }
else{ $lang = 'en'; } // Default language as English or the one u prefer
?>
<?php $cmtx_question_query = mysql_query("SELECT * FROM `".$cmtx_mysql_table_prefix."questions` WHERE `lang`='".$lang."' ORDER BY Rand() LIMIT 1"); ?>
------------------------------
(13-Sep-2012, 09:39 AM)hugo_bcn Wrote: Good job Pier.. Thanks v.m.
I am in the same situation, and by chance, also use the same variable name $lang storing the ISO code.
I was willing to modify directly the /includes/classes/settings.php to replace directly the $cmtx_settings->language_frontend value returned, when I stopped into your solution.
One issue I continue having is, how to deal with different languages, when use the questions feature, instead of the recatpcha ( because it is less user friendly ).
I am searching where are stored the questions, in order to find the way to solve this.
13-Sep-2012, 02:21 PM
Hi,
I was about to suggest the same solution.
However I would sanitize the variable $lang before using it in the MySQL query.
<?php if(isSet($_GET['lang'])){
$lang = $_GET['lang'];
}else if(isSet($_SESSION['lang'])){
$lang = $_SESSION['lang'];
}else if(isSet($_COOKIE['lang'])){
$lang = $_COOKIE['lang']; }
else{ $lang = 'en'; } // Default language as English or the one u prefer
$lang = cmtx_sanitize($lang, true, true, true);
?>
I was about to suggest the same solution.
However I would sanitize the variable $lang before using it in the MySQL query.
<?php if(isSet($_GET['lang'])){
$lang = $_GET['lang'];
}else if(isSet($_SESSION['lang'])){
$lang = $_SESSION['lang'];
}else if(isSet($_COOKIE['lang'])){
$lang = $_COOKIE['lang']; }
else{ $lang = 'en'; } // Default language as English or the one u prefer
$lang = cmtx_sanitize($lang, true, true, true);
?>
14-Sep-2012, 03:07 AM
Yes. Of course Steve. I showed that code, only as an example, coz depends of how is treated the variable in each application.
Thanks for your feedback.
Thanks for your feedback.
04-Jun-2013, 10:28 PM
Steven,
I've tried to understand what pier did and how he did it.
However the explanation is to short for me to get it to work.
If this solution is actually working, would it be much work for you
to setup a small guide based on this, with some guidelines and
for instance publish it in the faq?
Compliments for this great application and the work and time you seem to invest in it!
(do you also have a life? ;-)
Cheers,
John
I've tried to understand what pier did and how he did it.
However the explanation is to short for me to get it to work.
If this solution is actually working, would it be much work for you
to setup a small guide based on this, with some guidelines and
for instance publish it in the faq?
Compliments for this great application and the work and time you seem to invest in it!
(do you also have a life? ;-)
Cheers,
John
« Next Oldest | Next Newest »
Possibly Related Threads…
Thread / Author
Replies
Views
Last Post
Users browsing this thread: 1 Guest(s)