【问题标题】:Multiply Index pages using Joomla使用 Joomla 增加索引页面
【发布时间】:2012-07-16 02:53:12
【问题描述】:

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

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

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

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

有什么建议吗?

【问题讨论】:

    标签: php joomla indexing


    【解决方案1】:

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

    作为替代方案,您是否查看过Joomla! Extension Directory?它有一个User Management section,在第一页我可以看到一个 Joomla!名为 Terms of Service 的 2.5 插件可能适合您的需求。

    【讨论】:

      【解决方案2】:

      您不能只在 joomla 中重命名 index.php。它是您网站的入口点,它初始化/路由/运行您的 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-11-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-02-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多