Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Joomla PHP在来自定制PHP的文章中包含调用变量_Php_Variables_Joomla_Article - Fatal编程技术网

Joomla PHP在来自定制PHP的文章中包含调用变量

Joomla PHP在来自定制PHP的文章中包含调用变量,php,variables,joomla,article,Php,Variables,Joomla,Article,我已经安装了DirectPHP,它工作正常,我可以用PHP打印当前时间,所以我知道它工作正常 我的问题在于使用定制PHP调用变量并在我的所有文章中打印出来 首先:我的自定义php内部/media/custom.php <?php // Rental Prices Equipment $miniraeClassic_d = "$35.00"; $miniraeClassic_m = "$120.00"; $miniraeClassic_y = "$400.00"; $message = "

我已经安装了DirectPHP,它工作正常,我可以用PHP打印当前时间,所以我知道它工作正常

我的问题在于使用定制PHP调用变量并在我的所有文章中打印出来

首先:我的自定义php内部
/media/custom.php

<?php
// Rental Prices Equipment
$miniraeClassic_d = "$35.00";
$miniraeClassic_m = "$120.00";
$miniraeClassic_y = "$400.00";

$message = "Hello World";
?>

Fourth:结果如下:在我的文章中,它不会打印$message,但会打印日期和时间

It did not print out $message
in my article, the only thing it printed out was

Now is: 2014-05-28 22:21:50 

我想在我的文章中调用多个变量

<table border="0" width="100%">
<tr>
<td width="32%" align="center" class="table-title"><b>Daily</b></td>
<td width="34%" align="center" class="table-title"><b>Weekly</b></td>
<td width="34%" align="center" class="table-title"><b>Monthly</b></td>
</tr>
<tr>
<td align="center" class="table-content"><?= $dayrental?></td>
<td align="center" class="table-content"><?= $weekrental?></td>
<td align="center" class="table-content"><?= $monthrental?></td>
</tr>

每日的
周报
月刊

尝试使用以下方法导入自定义php文件:

<?php
    include(JUri::root() . 'templates/' . $this->template . '/media/custom.php');
?>


JUri::root()
定义了代码中未定义的Joomla安装的根目录

我现在就试过了,将它改为并添加了自定义php,在我的模板index.php所在的地方,我的文章中仍然没有“hello world”消息。但是,我添加了自定义php
code
<table border="0" width="100%">
<tr>
<td width="32%" align="center" class="table-title"><b>Daily</b></td>
<td width="34%" align="center" class="table-title"><b>Weekly</b></td>
<td width="34%" align="center" class="table-title"><b>Monthly</b></td>
</tr>
<tr>
<td align="center" class="table-content"><?= $dayrental?></td>
<td align="center" class="table-content"><?= $weekrental?></td>
<td align="center" class="table-content"><?= $monthrental?></td>
</tr>
<?php
    include(JUri::root() . 'templates/' . $this->template . '/media/custom.php');
?>