我使用WHMCS,并试图为我的标题菜单创建一个单独的文件。标题菜单是一个多维数组,为了我自己的理智,我希望它是独立的。
我用下面的MySQL代码创建了一个.php页面:
<?php ...
# To assign variables to the template system use the following syntax.
# These can then be referenced using {$variablename} in the template.
$smartyvalues["variablename"] = $value;
$list = array();
$result = full_query("SELECT id,title,slug,parent FROM `pages` WHERE title!='404' AND slug!='404'");
...
$smartyvalues["header"] = $list;
# Define the template filename to be used without the .tpl extension
$templatefile = "headermenu";
outputClientArea($templatefile);
?>headermenu.tpl按原样显示菜单,但当我尝试在其他地方包含该文件时,菜单为空。我添加了一些静态内容,结果显示。我尝试使用{include}和{include_php}都没有用。你知道如何显示我的MySQL结果,而不是直接把它放到我需要的文件中吗?
发布于 2012-11-15 08:39:40
我想不出通过.tpl包含该文件的方法,所以我创建了一个.php并将其包含在{include_php}中。.php包含了我的MySQL代码,在包含该文件之后,我能够根据需要显示MySQL结果。
https://stackoverflow.com/questions/13369838
复制相似问题