这是我翻译网站的计划,可能是绝对错误的,所以要纠正我:
$(document).ready(function () {
var $buttons = $('.panel[data-refresh-url!=""][data-refresh-url]');
for (var i = 0; i < $buttons.length; ++i)
{
$.extend($buttons[i], {
refresh: function (successFunc)
{
alert("Hey, I'm a button");
}
});
}
// TESTING
$('.panel[data-refresh-url!=""][data-refresh-url]')[0].refresh();
});
现在,x.com/index.php包含了从mysql和翻译中呈现表格所需的所有文件。
x.com/index.php示例
.htaccess redirect -> x.com/y -> /y/index.php
这里提到的所有包含都在x.com目录中。
我的计划是在index.php的每个语言子目录中执行此操作:
<body>
<?php include_once("analyticstracking.php") ?><?php include_once("lang.php") ?>
<!-- Header -->
<a href="#fourth" class="button scrolly"><?php echo lang('f');?> </a>
<a href="#fifth" class="button scrolly"><?php echo lang('g');?></a>
<!-- First -->
<section id="first" class="main">
<header>
<div class="container">
<h2><img src="images/m9.png"></h2>
<p><?php echo lang('m'); echo lang('ba'); ?><br/>.
<section><center>
<?php include("m9.php") ?>
因此,每次我需要更改所有内容时,我只需要更改1个index.php文件。
这有可能吗?
如果重要的话,这是我的.htaccess:
<body>
<--? get language file from language sub --> <?php include_once("lang.php") ?>
<--? get php from home --> <?php require ("../index.php") ?>
</body?>
我得到的Php错误:
RewriteEngine On
RewriteCond %{HTTP:Accept-Language} ^en [NC]
RewriteRule ^$ http://xcsgo.com/en[L,R=301]
RewriteCond %{HTTP:Accept-Language} ^de [NC]
RewriteRule ^$ http://xcsgo.com/de [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^fi [NC]
RewriteRule ^$ http://xcsgo.com/fi [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^fr [NC]
RewriteRule ^$ http://xcsgo.com/fr [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^sw [NC]
RewriteRule ^$ http://xcsgo.com/sw[L,R=301]
RewriteRule ^$ http://xcsgo.com/en [L,R=301]
将x.com/en php代码更改为:
PHP Fatal error: require(): Failed opening required 'http://x.comm/index2.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/local/php54/lib/php') in /home/x/public_html/y/en/index.php on line 30
这是错误:
<?php require("/home/y/public_html/x/index2.php") ;?>
<?php include_once("lang.php") ?>
答案 0 :(得分:1)
您应该在主域名地址中创建一个配置文件并设置它的名称config.php
,或者按照您的意愿设置,然后将所有默认设置放入其中,如下例所示:
/*DataBase Configuration!*/
define("DB_HOST","localhost");
define("DB_USER", "root");
define("DB_PASSWORD","root");
define("DB_PREFIX", "prefix_");
define("DB_NAME", "db_name");
/*Directories Configuration!*/
define('DIR_ENGINE', 'C:/xampp/htdocs/main_directories/engine/');
define('DIR_CP', 'C:/xampp/htdocs/main_directories/hyperCP/');
define('DIR_MAIN', 'C:/xampp/htdocs/main_directories/');
define('DIR_LANGUAGE', 'C:/xampp/htdocs/main_directories/languages/');
define('DIR_TEMPLATE', 'C:/xampp/htdocs/main_directories/themes/');
define('DIR_IMAGE', 'C:/xampp/htdocs/main_directories/images/');
define('DIR_UPLOAD', 'C:/xampp/htdocs/main_directories/upload/');
/*SYSTEM CONTROL */
define("ERROR_ACTIVE",1);
define("TEST_MODE",false);
define("MAIN_LANG","ar");
define('TEMPLATE_ACTIVE', 'default');
并且您应该在安装过程中设置此设置,之后在所有应用程序文件中都必须包含它! 要定义你应该得到的语言,你可以使用session,当用户注册时,他选择喜欢的语言并将其保存在数据库中,之后当他登录时从数据库中取出并将其保存在会话中然后应用类似的东西这个:
if(
isset($_SEESION['lang']) &&
$_SEESION['lang'] =='ar' ||
$_SEESION['lang']==1){
get_lang($_SEESION['lang']);
}else{
get_lang(DEFAULT_LANG);
}