Topic: CuteNews API
How to use the API to add news to the site without using the built-in editor ? With the ability to specify and additional fields.
Dear CuteNews Users! Please feel free to contact us via our new Feedback Form and please send information about bugs to our bug tracker.
You are not logged in. Please login or register.
CutePHP Forums → Problem Solving / Help & Support → CuteNews API
How to use the API to add news to the site without using the built-in editor ? With the ability to specify and additional fields.
But when you add a record to the database , it is assigned id = 0 and post is added to the end of the base ??
<?php
$id = time();
$data = array(
"t" => "Заголовок запиÑи", // title
"s" => "ÐšÐ¾Ñ€Ð¾Ñ‚ÐºÐ°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ новоÑти..", //short story
"f" => "Ð¿Ð¾Ð»Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ новоÑти", // full story
"c" => "3", // set category
"u" => "Bukreevladimir", // set author
"ht" => "1", // ...?
"mf" => Array(
"picpost" => "", // additional field's
"importante" => "Y", // additional field's
"videopost" => "", // additional field's
),
);
require_once 'vbase/cn_api.php';
cn_api_add_news($id, $data)
?>
Support Team, help?
Added post through the API. In the list of all the posts it appears at the bottom. Why ?
After clicking Edit News, the post is correct, as the most recent entries at the top.
Help! Because no information on the API.
You're doing everything right. You need to modify the API code. For that, you need to edit cn_api.php in Cutenews root.
Delete the following lines:
// add index data
$w = fopen(db_index_file_detect(), 'a+');
fwrite($w, base_convert($id, 10, 36).':'.$data['c'].':'.base_convert($user['id'], 10, 36).':'.count($data['co']).'::'."\n");
fclose($w);
And replace them with:
db_index_add($id, $data['c'], $user['id'], $data['is_draft']);
In this case, the index will be build correctly.
Thank you, it works! I would like the next version to see callback that would like to know added entry or error.
CutePHP Forums → Problem Solving / Help & Support → CuteNews API
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.