尝试在 PHPbb 论坛的每个页面上放置头像。仅显示在索引页中...有什么想法吗?

发布于 2024-10-05 15:53:41 字数 850 浏览 6 评论 0原文

我试图让它工作的网站是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红焚 2024-10-12 15:53:43

IIRC get_user_avatar() 是来自 functions_display 的函数。如果你想在函数文件中使用它,你必须包含它。

将其放入 if 条件中,使其仅在您所在的页面尚未包含 function_display 时才加载:

if(!function_exists('get_user_avatar')){ include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); }

IIRC get_user_avatar() is a function from functions_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:

if(!function_exists('get_user_avatar')){ include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx); }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文