The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
|||
|
|||
Truncating Video Text
I figured I'd ask this in here instead of the mod since it's probably a general answer instead of thread specific. I have tried figuring this out myself and I just can't get it. I use the video mod and the mod that adds random videos to my homepage. All I am looking to do is truncate the video title text. Here is the plugin code:
Code:
if ($vbulletin->products['videodirectory'] AND ($permissions['videodirectorypermissions'] & $vbulletin->bf_ugp_videodirectorypermissions['canview'])) { //Require functions_videodirectory.php to fetch thumbnail url require_once(DIR . '/includes/functions_videodirectory.php'); $fh_limit = $vbulletin->options['fh_limit']; $vert_horiz = $vbulletin->options['vert_horiz']; $charactertotal = $vbulletin->options['charactertotal']; //If $fh_limit is equal to 0 then this code will not run if ($fh_limit > 0) { $cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "videocategory"); $allowedcats = array(0); while ($cat = $db->fetch_array($cats)) { if (!is_member_of($vbulletin->userinfo, explode(',', $cat['usergroups'])) OR !$cat['active']) { continue; } $allowedcats[] = $cat['videocategoryid']; } switch ($vbulletin->options['vid_order']) { case 'recent': $videos = $db->query_read(" SELECT video.*, user.*, IF(video.ratingnum > 0, video.ratingtotal / video.ratingnum, 0) AS ratingavg, IF(NOT ISNULL(user.userid), user.username, video.username) AS username FROM " . TABLE_PREFIX . "video AS video LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = video.userid) WHERE video.videocategoryid IN(" . implode(',', $allowedcats) . ") ORDER BY dateline DESC LIMIT " . $fh_limit . " "); $title = 'Recent Videos'; break; case 'most_viewed': $videos = $db->query_read(" SELECT video.*, user.*, IF(video.ratingnum > 0, video.ratingtotal / video.ratingnum, 0) AS ratingavg, IF(NOT ISNULL(user.userid), user.username, video.username) AS username FROM " . TABLE_PREFIX . "video AS video LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = video.userid) WHERE video.videocategoryid IN(" . implode(',', $allowedcats) . ") AND video.views > 0 ORDER BY views DESC LIMIT " . $fh_limit . " "); $title = 'Most Viewed Videos'; break; case 'best_rated': $videos = $db->query_read(" SELECT video.*, IF(video.ratingnum > 0, video.ratingtotal / video.ratingnum, 0) AS ratingavg FROM " . TABLE_PREFIX . "video AS video WHERE video.videocategoryid IN(" . implode(',', $allowedcats) . ") ORDER BY ratingavg DESC, ratingnum DESC LIMIT " . $fh_limit . " "); $title = 'Top Rated Videos'; break; default: $videos = $db->query_read(" SELECT video.*, user.*, IF(video.ratingnum > 0, video.ratingtotal / video.ratingnum, 0) AS ratingavg, IF(NOT ISNULL(user.userid), user.username, video.username) AS username FROM " . TABLE_PREFIX . "video AS video LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = video.userid) WHERE video.videocategoryid IN(" . implode(',', $allowedcats) . ") ORDER BY RAND() DESC LIMIT " . $fh_limit . " "); $title = 'Random Videos'; } if ($vbulletin->options['video_forumlist'] == 0) { if ($db->num_rows($videos)) { while ($video = $db->fetch_array($videos)) { $bgclass = exec_switch_bg(); fetch_videothumbnail($video); $video['url'] = construct_video_url($video); if ($vert_horiz == 0) { eval('$fhlist .= "' . fetch_template('video_fh_bit') . '";'); } else { eval('$fhlist .= "' . fetch_template('video_fh_bit_vert') . '";'); } } eval('$fhlist_shell = "' . fetch_template('video_fh_shell') . '";'); } } else { while ($fh = $db->fetch_array($videos)) { $fhvideoid = htmlspecialchars_uni($fh['videoid']); fetch_videothumbnail($fh); $fhtitle = $fh['title']; if ($charactertotal == 0) { $fhdescription = $fh['description']; } else { $fhdescription = substr($fh['description'],0,$charactertotal); } $fhviews = $fh['views']; $fhrating = $fh['rating']; $fhcommentcount = $fh['commentcount']; //If there are comments for the video then this query will run. if ($fhcommentcount > 0) { $comment_query = $db->query(" SELECT * FROM " . TABLE_PREFIX . "videocomment WHERE videoid = " . $fhvideoid . " AND state = 'visible' LIMIT 1"); $comment = $db->fetch_array($comment_query); $commentuserid = $comment['postuserid']; $commentusername = $comment['postusername']; $commentdate = vbdate($vbulletin->options['dateformat'], $comment['dateline'], true); } eval('$fhlist .= "' . fetch_template('video_forumlist') . '";'); } eval('$fhlist_shell = "' . fetch_template('video_fh_shell_detail') . '";'); } } } I would like the title to be a maximum of 15 characters. I just need to figure out what to add into the plugin code. Thanks in advance for any help!! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|