尝试在 PHPbb 论坛的每个页面上放置头像。仅显示在索引页中...有什么想法吗?
我试图让它工作的网站是 http://www.phone7forum.com/
我的方式让它显示在索引页面上的方法是将此代码添加到核心 index.php 页面的正下方:
// Assign index specific vars
'S_AVATAR' => get_user_avatar(
$user->data['user_avatar'],
$user->data['user_avatar_type'],
$user->data['user_avatar_width'],
$user->data['user_avatar_height']
),
然后我可以在我的模板中使用 {S_AVATAR} 但它只显示在索引文件中...所以另一个 phpbb 家伙建议我从上面获取相同的代码并将其放入包含/functions.php文件中,如下所示:
// The following assigns all _common_ variables that may be used at any point in a template.
我这样做了,虽然它似乎“尝试”并且工作,但我单击了索引页面之外的几个页面并得到了致命错误消息:
致命错误:在第 4385 行调用 /home/content/04/6534704/html/phone7forum/includes/functions.php 中未定义的函数 get_user_avatar()
有人有任何想法吗?
The website that im trying to make it work on is http://www.phone7forum.com/
The way I get it to show up on the index page is adding this code to the core index.php page right below this:
// Assign index specific vars
'S_AVATAR' => get_user_avatar(
$user->data['user_avatar'],
$user->data['user_avatar_type'],
$user->data['user_avatar_width'],
$user->data['user_avatar_height']
),
Then I can use {S_AVATAR} in my template but it ONLY shows up in the index file... So another phpbb guy suggested that I take that same code from above and place it in the includes/functions.php file right below this:
// The following assigns all _common_ variables that may be used at any point in a template.
I did that, and though it seemed to "try" and work I clicked on a few pages outside the index page and got a fatal error message:
Fatal error: Call to undefined function get_user_avatar() in /home/content/04/6534704/html/phone7forum/includes/functions.php on line 4385
Does anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IIRC get_user_avatar()
是来自functions_display
的函数。如果你想在函数文件中使用它,你必须包含它。将其放入 if 条件中,使其仅在您所在的页面尚未包含
function_display
时才加载:IIRC get_user_avatar()
is a function fromfunctions_display
. If you want to use it in the functions file, you have to include it.Put it into an if condition to have it only load if you're on a page where
function_display
isn't already included: