Announcement
Collapse
No announcement yet.
Display latest topics on non-vb pages
Collapse
X
-
I have two forums with latest vBulletin. API is activated on both sites, but I have missed anything in configuration for it to work?
www.ciklid.org - Not working
www.zoopet.com - Working
https://www.zoopet.com/forum/api/test.php
PHP Code:<?
$vbpath = '..';
define('CSRF_PROTECTION', false);
require_once($vbpath . '/includes/vb5/autoloader.php');
vB5_Autoloader::register($vbpath);
vB5_Frontend_Application::init('config.php');
$api = Api_InterfaceAbstract::instance();
$search_json = '{ "last":{"from":"100"}, "view":"topic","starter_only":"1", "sort":{"lastcontent":"desc"}, "channel":["18"] }';
$threads = vB_Api::instanceInternal('search')->getInitialResults($search_json, 30, 1);
$i = 0;
$thread_returns = array();
foreach ($threads['results'] as $tid => $thread_details) {
$i++;
$thread_returns['results'][$i] = array(
'title' => $thread_details['content']['title'],
'publishdate' => $thread_details['content']['publishdate'],
'channeltitle' => $thread_details['content']['channeltitle']
);
$thread_returns['results'][$i]['postlink'] = vB5_Route::buildUrl(
$thread_details['routeid'] . '|fullurl',
array(
'nodeid' => $thread_details['nodeid'],
'title' => $thread_details['title']
)
);
}
$thread_returns['totalRecords'] = count($thread_returns['results']);
$thread_returns['searchJSON'] = $search_json;
$thread_returns['days'] = $num_days;
if ($thread_returns['totalRecords'] > 0) {
header('Content-Type: application/json');
echo json_encode($thread_returns);
}
?>
- Top
- Translate
- Bottom
Comment
Users Viewing This Page
Collapse
There is 1 user viewing this forum topic.
- Guest
Latest Posts
Collapse
-
Comment on Topic Starter Ribbon for vBCloudby glennrocksvbThanks for confirming the fix works.04-26-2024, 08:20 AM
-
Reply to Topic Starter Ribbon for vBCloudby MitchSeems to have done the trick
TY04-26-2024, 07:40 AM -
Get Affordable and Fast VPS for vBulletin -
Reply to Topic Starter Ribbon for vBCloudby glennrocksvbI have updated the template code in the first post. Please try it again.04-26-2024, 06:38 AM
Comment