<bdo id='YW948'></bdo><ul id='YW948'></ul>

  1. <legend id='YW948'><style id='YW948'><dir id='YW948'><q id='YW948'></q></dir></style></legend>

  2. <small id='YW948'></small><noframes id='YW948'>

      <tfoot id='YW948'></tfoot>
    1. <i id='YW948'><tr id='YW948'><dt id='YW948'><q id='YW948'><span id='YW948'><b id='YW948'><form id='YW948'><ins id='YW948'></ins><ul id='YW948'></ul><sub id='YW948'></sub></form><legend id='YW948'></legend><bdo id='YW948'><pre id='YW948'><center id='YW948'></center></pre></bdo></b><th id='YW948'></th></span></q></dt></tr></i><div id='YW948'><tfoot id='YW948'></tfoot><dl id='YW948'><fieldset id='YW948'></fieldset></dl></div>

      如何在 Joomla 模板中包含 PHP 函数文件

      时间:2023-10-16

    2. <legend id='4kNvq'><style id='4kNvq'><dir id='4kNvq'><q id='4kNvq'></q></dir></style></legend>
      • <bdo id='4kNvq'></bdo><ul id='4kNvq'></ul>
        • <i id='4kNvq'><tr id='4kNvq'><dt id='4kNvq'><q id='4kNvq'><span id='4kNvq'><b id='4kNvq'><form id='4kNvq'><ins id='4kNvq'></ins><ul id='4kNvq'></ul><sub id='4kNvq'></sub></form><legend id='4kNvq'></legend><bdo id='4kNvq'><pre id='4kNvq'><center id='4kNvq'></center></pre></bdo></b><th id='4kNvq'></th></span></q></dt></tr></i><div id='4kNvq'><tfoot id='4kNvq'></tfoot><dl id='4kNvq'><fieldset id='4kNvq'></fieldset></dl></div>
            <tbody id='4kNvq'></tbody>

          1. <small id='4kNvq'></small><noframes id='4kNvq'>

            <tfoot id='4kNvq'></tfoot>
              1. 本文介绍了如何在 Joomla 模板中包含 PHP 函数文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我一直试图在我的模板中包含一个文件,其中包含一些我打算用于验证成员访问级别的功能,以便在 Joomla 2.5 中为不同类型的用户定制内容.问题是即使我使用了标准的 PHP 包含语句,模板中似乎没有任何函数可用.调用函数会导致使用模板的任何页面崩溃.我可以对正在工作的模板顶部的函数进行硬编码,但我也计划在我的 Web 应用程序的其他地方使用一些函数,因此将它们存储在包含文件中是有意义的.有没有人深入了解为什么这些函数在包含时不起作用,但在添加到模板顶部时起作用?以下是我的模板中包含语句的前几行:

                I have been trying to include a file in my template which includes some functions I was intending to use for validation of the access level a member has in order to tailor content for different types of users in Joomla 2.5. The trouble is even though I have used the standard PHP include statement, none of the functions appear to be usable in the template. Instead calling the functions causes any pages using the template to crash. I could hard code the functions at the top of the template which is working, but I also have plans to use some the functions elsewhere in my web application, so it makes sense to store them in an include file. Does anyone have some insight into why the functions do not work from an include, but do when added to the top of the template? The following is the top few lines of my template with the include statement:

                <?php 
                defined( '_JEXEC' ) or die( 'Restricted access' );
                JHtml::_('behavior.framework', true);
                
                include ("/includes/checkAccess.php");
                

                请注意,当硬编码到模板中时,这些功能都可以正常工作,因此肯定是包含的问题.此外,上面的包含路径似乎是正确的,因为如果添加了上面的包含行,模板仍然可以正常工作,除非调用它包含的函数之一.

                Please note the functions all work fine when hard-coded into the template, so it is definitely a problem with the include. Also, the include path above appears to be correct because if the include line above is added, the template still works fine unless a call is made to one of the functions it contains.

                推荐答案

                我已经想通了.我上面的包含路径不正确,即使它没有抛出错误(除非我从包含中调用了一个函数).以下是正确的并且成功地将函数拉入模板中:

                I have figured it out. The include path I had above was not correct even though it wasn't throwing an error (unless I called a function from the include). The following is correct and succeeds in pulling the functions through into the template:

                include ("./includes/checkAccess.php");
                

                这篇关于如何在 Joomla 模板中包含 PHP 函数文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:WHERE 语句在 Joomla 中不起作用!3.0.3.php请求 下一篇:使用 curl 登录 Joomla 2.5

                相关文章

                  <bdo id='GiVE4'></bdo><ul id='GiVE4'></ul>
              2. <tfoot id='GiVE4'></tfoot>
                  <i id='GiVE4'><tr id='GiVE4'><dt id='GiVE4'><q id='GiVE4'><span id='GiVE4'><b id='GiVE4'><form id='GiVE4'><ins id='GiVE4'></ins><ul id='GiVE4'></ul><sub id='GiVE4'></sub></form><legend id='GiVE4'></legend><bdo id='GiVE4'><pre id='GiVE4'><center id='GiVE4'></center></pre></bdo></b><th id='GiVE4'></th></span></q></dt></tr></i><div id='GiVE4'><tfoot id='GiVE4'></tfoot><dl id='GiVE4'><fieldset id='GiVE4'></fieldset></dl></div>

                  <small id='GiVE4'></small><noframes id='GiVE4'>

                1. <legend id='GiVE4'><style id='GiVE4'><dir id='GiVE4'><q id='GiVE4'></q></dir></style></legend>