通过评论添加评论时如何在跑道评论中应用富文本格式API
How to apply Rich Text formatting in Podio comments while adding comments through comments API
我想对通过跑道评论添加的评论应用富文本格式(Markdown 语言)API。我已经添加了,但它对我不起作用。
我该怎么做?
<?php
error_reporting(0);
require_once 'config.php';
include 'podio_api.php';
echo "START";
// Podio authentication
podioAuthentication();
if (Podio::is_authenticated()) {
$ref_type = "item";
$ref_id = 603929471;
$response = PodioComment::get_for($ref_type, $ref_id);
$comments = '';
foreach ($response as $object) {
$comment = $object->value;
$date = $object->created_on;
$created_on = $date->format('Y-m-d H:i:s');
// Add comment
$comments .= "*[Created_On]* $created_on <br /> **[Comment]** $comment <br />";
}
$ref_id = 649113086;
$attributes = ['alert_invite' => FALSE,
'hook' => FALSE,
'silent' => FALSE,
'value' => $comments
];
$comment_add = PodioComment::create($ref_type, $ref_id, $attributes);
var_dump($comment_add);
echo "DONE";
} else {
echo "authentication error";
}
尝试将 "<br />"
替换为 "\n"
$comments .= "*[Created_On]* $created_on \n **[Comment]** $comment \n";
当我们在特殊字符前后留下 space 时,格式有效,在此评论中开发人员必须在 * 或 \n 之前和之后添加 space 然后它必须有效。
$comments .= " **[Created_On]** $created_on \n **[Comment]** $comment \n ";
我想对通过跑道评论添加的评论应用富文本格式(Markdown 语言)API。我已经添加了,但它对我不起作用。 我该怎么做?
<?php
error_reporting(0);
require_once 'config.php';
include 'podio_api.php';
echo "START";
// Podio authentication
podioAuthentication();
if (Podio::is_authenticated()) {
$ref_type = "item";
$ref_id = 603929471;
$response = PodioComment::get_for($ref_type, $ref_id);
$comments = '';
foreach ($response as $object) {
$comment = $object->value;
$date = $object->created_on;
$created_on = $date->format('Y-m-d H:i:s');
// Add comment
$comments .= "*[Created_On]* $created_on <br /> **[Comment]** $comment <br />";
}
$ref_id = 649113086;
$attributes = ['alert_invite' => FALSE,
'hook' => FALSE,
'silent' => FALSE,
'value' => $comments
];
$comment_add = PodioComment::create($ref_type, $ref_id, $attributes);
var_dump($comment_add);
echo "DONE";
} else {
echo "authentication error";
}
尝试将 "<br />"
替换为 "\n"
$comments .= "*[Created_On]* $created_on \n **[Comment]** $comment \n";
当我们在特殊字符前后留下 space 时,格式有效,在此评论中开发人员必须在 * 或 \n 之前和之后添加 space 然后它必须有效。
$comments .= " **[Created_On]** $created_on \n **[Comment]** $comment \n ";