Thread: vBulletin CMS Widgets - United-Forum Nivo Slider Widget
View Single Post
  #91  
Old 08-04-2011, 10:32 AM
Mooff Mooff is offline
 
Join Date: Mar 2010
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

updated Version to 1.0.0

1.0.0 (4.08.2011)
  • confirmed working with 4.1.5 on our testsite, changed jquery path to account for 4.1.5 and below (now using the file which is uploaded in the zip)
  • minor changes in the database query code
  • fixed a bug where articles did show up in the slider even though their publish date was in the future


@The Rocketeer
As promised a query which does select specific articles - and nothing else. Just search and replace the top part of the php-widget code with this (you need to keep the bottom part in).

Code:
// DEBUG MODUS !
$debug_modus = false;

if($debug_modus === false)
{
	ob_start();
}

//nivo slider - uf - vb.org version
//set these values as you need them:

//your slider folder - has to be read and writeable
//folder where all slider files are saved
$slider_img_filepath = 'external/unitedforum/slider/';   

//picture width and height !same as in the CSS FILE!
$maxwidth = 650;                                  
$maxheight = 250;    

//do you want images without previewimage to be shown? slider is using the fallback then
$show_articles_without_image = false;           

//picture shown if your articles has no previewpicture
$fallback_img = $slider_img_filepath . 'uf_fallback_slider.png';  

//hardcoded maximum is 20 - if you want more just ask
$number_of_articles_shown = 20;                                
            
//lengh in characters of the article descriptions
$description_length = 95;

//specific articles you want to show
//../content.php?r=222-... (hover the edit button r= xxx is the id you want)
$articleids = '(222, 219)';


//Debug Messages
if($debug_modus)
{
	echo "<span style='color:red;'>DEBUG MODE is ON! </span><br />";
	echo "slider_img_filepath: $slider_img_filepath <br />";
	echo "width: $maxwidth   height: $maxheight <br />";
	echo "show_articles_without_image: $show_articles_without_image <br />";
	echo "fallback_img: $fallback_img <br />";
	echo "#img: $number_of_articles_shown <br />";
	echo "description_length: $description_length <br />";
	echo 'directory ' . DIR . '<br />';

}


$article_type = vb_Types::instance()->getContentTypeID("vBCms_Article");
$time = TIMENOW;
 
if(!extension_loaded('gd'))
{
	echo '<span style="color:red">Error occurred:</span> Your System does not support the GD-Libary. Please install the GD-Libary.<br />';
}
       
	$article_get = vB::$db->query_read('
        SELECT
            article.pagetext,
            article.previewimage,
            node.url,
            node.publishdate,
            node.parentnode,
            parentnode.url AS parenturl,
            thread.replycount,
            info.title,
            node.nodeid,           
            GROUP_CONCAT( category.category )
        FROM
            '.TABLE_PREFIX.'cms_article AS article INNER JOIN
            '.TABLE_PREFIX.'cms_node AS node 
                ON (node.contentid = article.contentid AND node.contenttypeid = ' . vb::$db->sql_prepare($article_type) .') INNER JOIN
            '.TABLE_PREFIX.'cms_nodeinfo AS info 
                ON info.nodeid = node.nodeid INNER JOIN
            '.TABLE_PREFIX.'cms_node AS parentnode 
                ON parentnode.nodeid = node.parentnode LEFT JOIN
            '.TABLE_PREFIX.'thread AS thread ON thread.threadid = info.associatedthreadid LEFT JOIN
            '.TABLE_PREFIX.'cms_nodecategory AS nodecategory ON nodecategory.nodeid = node.nodeid LEFT JOIN
            '.TABLE_PREFIX.'cms_category AS category ON nodecategory.categoryid = category.categoryid 
        WHERE
            node.setpublish = 1 AND
			node.publishdate < '. vb::$db->sql_prepare($time) .' AND
			node.nodeid IN '. vb::$db->escape_string($articleids) . '
        GROUP BY node.nodeid
        ORDER BY node.publishdate
        DESC LIMIT 20');
		
    $database_articles = array();

then look for this part:
Code:
//specific articles you want to show
//../content.php?r=222-... (hover the edit button r= xxx is the id you want)
$articleids = '(222, 219)';
And include your ids!
syntax is $articleids = '(id, id2, id3, id4)';
Number of Articles is dynamic, just include up to 20 ids (i can up that limit if need be).
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01277 seconds
  • Memory Usage 1,790KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete