【发布时间】:2012-03-09 14:50:28
【问题描述】:
我需要引用一个特定的functions.php 文件,该文件可以存储在我的Joomla 模板的模板目录中。 WordPress 似乎包含此功能,但如果我执行以下操作:
包含函数文件
<?php require_once ( 'functions.php' ); ?>
在functions.php中:
<?php
function displaySomething() {
echo "Hello World";
}
?>
然后在模板 index.php 中:
<?php displaySomething(); ?>
模板中断/为空白。为了 aguements,我只想有一个可引用的 php case 函数。
【问题讨论】:
-
我不确定,但它可能是从主索引文件(不是模板的文件)计算的路径,尝试使用
templates/templatename/functions.php(或最新Joomla 中的任何内容)。并启用error_reporting,顺便说一句(在Joomla的配置和服务器上)