|Jordan|
Active member
This will probably take the average Xenforo coder seconds to fix but i have a php file that displays the latest 4 threads from specific nodes and dispalys the thread title and 400 characters of the first post.
I only want certain html tags to be included in the post output: Bold, Italic, Underline, Link, Ordered List, Unordered List, Indent and Outdent. If the message contains any of the tags i dont want displayed, then it shouldn't include what was in those tags (for example [media]http://youtube.com[/media] ).
Here's my code:
I dont know how much something like this would cost, but i assume it wouldn't take longer than a few minutes to make.
I need this done ASAP. Any takers?
I only want certain html tags to be included in the post output: Bold, Italic, Underline, Link, Ordered List, Unordered List, Indent and Outdent. If the message contains any of the tags i dont want displayed, then it shouldn't include what was in those tags (for example [media]http://youtube.com[/media] ).
Here's my code:
PHP:
<?php
$forumUrl = 'https://ftwgamer.com'; //Forum URL, must end with slash
$limit = 4;
$nodes = array("18", "2");
$startTime = microtime( true );
// Set to forum location - See XenForo index.php for information
$fileDir = '../';
require( $fileDir . '/library/XenForo/Autoloader.php' );
XenForo_Autoloader::getInstance()->setupAutoloader( $fileDir . '/library' );
XenForo_Application::initialize( $fileDir . '/library', $fileDir );
XenForo_Application::set( 'page_start_time', $startTime );
$threadModel = XenForo_Model::create( 'XenForo_Model_Thread' );
$threads = $threadModel->getModelFromCache('XenForo_Model_Thread')->getThreads( array(
'discussion_state' => 'visible',
'node_id' => $nodes,
), array(
'limit' => $limit,
'order' => 'thread_id',
'orderDirection' => 'desc'
) );
foreach ($threads as $thread) {
$postModel = XenForo_Model::create('XenForo_Model_Post');
$post = $postModel->getPostById($thread['first_post_id']);
$bbCodeParser = new XenForo_BbCode_Parser(new XenForo_BbCode_Formatter_Wysiwyg);
$bbCodeOptions = array(
'showSignature' => false,
'states' => array(
'viewAttachments' => false,
'stopLineBreakConversion' => true,
)
);
$threadTitle = $thread['title'];
$threadUrl = $threadUrl = $forumUrl. XenForo_Link::buildPublicLink('threads', $thread);
$message = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($post, $bbCodeParser, $bbCodeOptions);
echo
"<h3><a href=\"$threadUrl\">"
. XenForo_Helper_String::wholeWordTrim($threadTitle, 50)
. "</a></h3>"
. XenForo_Helper_String::wholeWordTrim($message, 400)
;
}
?>
I dont know how much something like this would cost, but i assume it wouldn't take longer than a few minutes to make.
I need this done ASAP. Any takers?
Last edited: