0

我使用 Joomla 来创建我的网站。

在前端用户可以看到网站的其余部分之前,我需要一个免责声明页面。

我使用免责声明信息创建了一个新的“index.php”页面,并带有指向该站点的链接 - 我将原始 php 文件重命名为“index1.php”

“Index.php”视图,但链接不想工作。我的代码似乎完全正确。

请问有什么建议吗?

4

2 回答 2

0

您不能只index.php在 joomla 中重命名。它是您网站的入口点,它初始化/路由/运行您的 joomla 应用程序。因此,您应该修改您的index.php,以便它识别第一次访问并将用户重定向到正确的页面。

将您的条款页面命名为first-time.php并修改index.php如下:

<?php
if (!isset($_COOKIE['firsttime']))
{
    setcookie("firsttime", "no", /* EXPIRE */);
    header('Location: first-time.php');
    exit();
}
else
{
// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(dirname(__FILE__) . '/defines.php')) {
    include_once dirname(__FILE__) . '/defines.php';
}

if (!defined('_JDEFINES')) {
    define('JPATH_BASE', dirname(__FILE__));
    require_once JPATH_BASE.'/includes/defines.php';
}

require_once JPATH_BASE.'/includes/framework.php';

// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;

// Instantiate the application.
$app = JFactory::getApplication('site');

// Initialise the application.
$app->initialise();

// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;

// Route the application.
$app->route();

// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;

// Dispatch the application.
$app->dispatch();

// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;

// Render the application.
$app->render();

// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
// Return the response.
echo $app;
}
?>
于 2012-07-17T08:11:18.360 回答
0

您是否考虑过将其创建为插件,而不是入侵您的网站并使应用更新成为问题?

作为替代方案,您是否查看过Joomla!扩展目录?它有一个用户管理部分,在第一页我可以看到一个 Joomla!2.5 插件称为服务条款,可能适合您的需求。

于 2012-07-17T11:17:59.587 回答