Code:
function output_News($a = 5,$f = ""){
global $db, $Data, $vbulletin;
// Define amount to show
$Amount = ($a)? intval($a) : 5;
// Define Forum To Pull From
$Forum = ($f)? intval($f): '';
if(!$Forum){
RunError("No specified forum to pull news from.");
}
// Load Template
$Template = LoadTemplate("news.html");
// Collect Data
$NewestNews = $db->query("
select t.*,p.pagetext
from ".TABLE_PREFIX."thread t
left join ".TABLE_PREFIX."post p on(p.postid=t.firstpostid)
where t.forumid = $Forum
order by dateline desc
limit 0,$Amount");
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
while($News = $db->fetch_array($NewestNews)){
$Data .= ParseTemplate($Template,
array(
'threadid' => $News['threadid'],
'threadname' => $News['title'],
'postuserid' => $News['postuserid'],
'postusername' => $News['postusername'],
'post' => $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f),
'comments' => vb_number_format($News['replycount']),
)
);
}
doOutput();
}
I'm using VBExternal on my website, and I need to modify that little bit of code displaying the actual news post to only output a maximum of 30 words, or 190 characters.
Code:
'post' => $bbcode_parser->parse(unhtmlspecialchars($News['pagetext']), $f),
I used to know how to do this through php, but I havn't coded for about 10 months and I've forgotten so much
__________________________________________________ ___
Figured it out, it was easier than I thought
Code:
'post' => $bbcode_parser->parse(unhtmlspecialchars(substr($News['pagetext'], 0, 100)), $f),
worked