首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >phpBB模板API错误

phpBB模板API错误
EN

Stack Overflow用户
提问于 2011-08-04 09:57:43
回答 1查看 432关注 0票数 0

我想添加线程并在phpBB中显示消息。这是我的代码:

代码语言:javascript
复制
<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);

$user->session_begin();
$auth->acl($user->data);


// New Topic Example
$subject = 'TEST: Test topic';
$message = 'This is test message';

$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;
generate_text_for_storage($text, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);

$data = array( 
    // General Posting Settings
    'forum_id'            => 2,    // The forum ID in which the post will be placed. (int)
    'topic_id'            => 0,    // Post a new topic or in an existing one? Set to 0 to create a new one, if not, specify your topic ID here instead.
    'icon_id'            => false,    // The Icon ID in which the post will be displayed with on the viewforum, set to false for icon_id. (int)

    // Defining Post Options
    'enable_bbcode'    => true,    // Enable BBcode in this post. (bool)
    'enable_smilies'    => true,    // Enabe smilies in this post. (bool)
    'enable_urls'        => true,    // Enable self-parsing URL links in this post. (bool)
    'enable_sig'        => true,    // Enable the signature of the poster to be displayed in the post. (bool)

    // Message Body
    'message'            => $message,        // Your text you wish to have submitted. It should pass through generate_text_for_storage() before this. (string)
    'message_md5'    => md5($message),// The md5 hash of your message

    // Values from generate_text_for_storage()
    'bbcode_bitfield'    => $bitfield,    // Value created from the generate_text_for_storage() function.
    'bbcode_uid'        => $uid,        // Value created from the generate_text_for_storage() function.

    // Other Options
    'post_edit_locked'    => 0,        // Disallow post editing? 1 = Yes, 0 = No
    'topic_title'        => $subject,    // Subject/Title of the topic. (string)

    // Email Notification Settings
    'notify_set'        => false,        // (bool)
    'notify'            => false,        // (bool)
    'post_time'         => 0,        // Set a specific time, use 0 to let submit_post() take care of getting the proper time (int)
    'forum_name'        => '',        // For identifying the name of the forum in a notification email. (string)

    // Indexing
    'enable_indexing'    => true,        // Allow indexing the post? (bool)

    // 3.0.6
    'force_approved_state'    => true, // Allow the post to be submitted without going into unapproved queue
);
$array = array();
$link = submit_post('post', $subject, '', POST_NORMAL, $array, $data);
//echo $link;

$template->assign_vars(array(
    'MESSAGE_TITLE'   => 'Okay',
    'MESSAGE_TEXT'    => 'Message added! <br /><br /><a href='.$link.'>Go to thread</a>',
   )
);

page_header();
$template->set_filenames(array(
        'body' => 'message_body.html',
));
page_footer();

线程正在创建,但消息没有显示错误:

模板->_tpl_load_ File ():文件message_body.html不存在或为空

如果我将'body‘=>’message_body.body‘改为'body’=> =>错误,则不会更改:

模板->_tpl_load_ File ():File//prosilver/template/message_load.load不存在或为空

哪里有错误?提前谢谢。

我来自俄罗斯,很抱歉英语很差。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-10 18:08:33

错误与API无关--您丢失了message_body.html模板文件。根据您的当前样式设置(可能是,也可能不是create ),您需要在当前样式的模板文件夹中创建一个名为message_body.html的非空白HTML文件,以解决此错误。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6939398

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档