vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   vBulletin CMS Widgets - United-Forum Nivo Slider Widget (https://vborg.vbsupport.ru/showthread.php?t=267024)

Sm1th146 08-10-2011 09:58 PM

Hmm I'm still having problems. I changed the file folder to the one of my personal computer but not everything is completed. Only 2 articles show up on the slider even though on the custom settings it is set for more and I read this message with the debug on...

PHP Code:

DEBUG MODE is ON!
slider_img_filepathuf_nivo_slider/
width650 height250
show_articles_without_image
:
fallback_imguf_nivo_slider/old-tunnel.jpg
#img: 5
description_length95
directory 
/home/tokeng5/public_html/forums 


Mooff 08-10-2011 10:00 PM

We are using the following modifikation:
https://vborg.vbsupport.ru/showthread.php?t=230417

All our articles are forum threads and comments show up in both the thread and the article.
(In my opinion that should be a basic vbcms function, but isn't)

Anyway. That does work very well for us.


The slider doesn't pick a random picture, it does use the article previewpicture which is selected by the vbcms system (which can be a http-picture or an attachment).


If it doesn't show images from your articles something is wrong. Please follow the steps in the faq. And yes, that thumbnail view in your slider link is possible with the nivo slider.

Mooff 08-10-2011 10:05 PM

@Sm1th146

please use the newest version, it has more debug.

In default mode the slider uses only articles which are not older than 40 days. Could that be a problem? That could be easily changed.

Sm1th146 08-10-2011 10:49 PM

I just re-installed the newest version and still running into a similar problem. The articles are with in the last 2 weeks so that isn't a problem. Here is the error I am receiving...

PHP Code:

DEBUG MODE is ON!
slider_img_filepathuf_nivo_slider/
width650 height250
show_articles_without_image
bool(false)
fallback_imguf_nivo_slider/uf_fallback_slider.png
#img: 5
description_length95
directory 
/home/tokeng5/public_html/forums
#articles - featured and databasepull int(2) int(4) 


Mooff 08-10-2011 10:53 PM

Debug shows that you have 4 articles within the last 40 days.
Out of those 4 articles 2 have a previewimage. And since you set 'show_articles_without_image' to false it does show the two articles which do have a previewimage and not the other 2.

andycaps 08-10-2011 11:45 PM

Quote:

Originally Posted by Mooff (Post 2222003)
The slider does use the pictures which vb4 stores in the databasefield "previewpicture" and resizes them. You do not need to manually add images except 1.
You need a fallback image if your article does not have a previewimage (or something goes wrong during resizing), then the fallback is shown.

Hi - I still cannot get the slider to show my images, the fall back image displayed no problem - any ideas?
thanks
Andy

Mooff 08-11-2011 12:07 AM

Please go through the faq in post two and see if that does help.

If it doesn't please post the debug (last faq question).

Regards Mooff

andycaps 08-11-2011 12:11 AM

Hi - I do not get any error messages, just my fall back image. I have gone through FAQ and everything appears to be set correctly?

tintin74 08-11-2011 09:12 AM

Great MOD! Thank you!

I've tried to develop a module for Vbadvanced CMPS but with no luck. I'm not a programmer. Does anyone could build this for us?

I think it's not so difficult for people with programming experience.

After building this I get this error:

Class 'vb_Types' not found

PHP Code:

<?php
//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 'fp-slider/';   

//picture width and height !same as in the CSS FILE!
$maxwidth 675;                                  
$maxheight 300;    

//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 'image.png';  

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

$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) .' -34560000 AND
            node.publishdate < '
vb::$db->sql_prepare($time) .'
        GROUP BY node.nodeid
        ORDER BY node.publishdate
        DESC LIMIT 20'
);
        
    
$database_articles = array();
    
    
/* my version of sorting the articles via relevance - i'll keep it in case someone is interested*/
    
while($article vB::$db->fetch_array($article_get))
    {
        
$article['value'] = ( - ($time $article['publishdate'] ) / 86400 ) * ( - ($time $article['publishdate'] ) / 86400 ) * ( - ($time $article['publishdate'] ) / 86400 ) + (10 $article['replycount']);
        
$database_articles[] = $article;        
    }
    
    foreach(
$database_articles as $c => $key)
    {
        
$sort_value[] = $key['value'];
    }
    
    
array_multisort($sort_valueSORT_DESC$database_articles);    
    
    
//
    
$i 0;
    
$section_array = array();
    
$featured_articles = array();
    
    foreach(
$database_articles AS $article)
    {

        
$section_array[$article['parentnode']]++;

        
$categories explode(',' $article['GROUP_CONCAT( category.category )']);
     
        if(
$show_articles_without_image == true OR $article['previewimage'])
        {
            if(
$section_array[$article['parentnode']] < 50 AND $i $number_of_articles_shown)
            {
            
                
//rebuild image to the height and width we want in the slider 
                //called sprite since i got the code from our sprite addon :P
                
$sprite imagecreatetruecolor($maxwidth$maxheight);
                if(
is_resource($sprite) AND $article['previewimage'] )
                {                   
                    
$imageinfo getimagesize($article['previewimage']);
                    if(
is_array($imageinfo))
                    {   
                        
$image null;
                        switch(
$imageinfo[2])
                        {
                            case 
IMAGETYPE_PNG:
                            
$image imagecreatefrompng($article['previewimage']);
                            break;
                            case 
IMAGETYPE_GIF:
                            
$image imagecreatefromgif($article['previewimage']);
                            break;
                            case 
IMAGETYPE_JPEG:
                            
$image imagecreatefromjpeg($article['previewimage']);
                            break;
                            default:
                            echo 
'<span style="color:red">Error occurred:</span> Unknown image format. ' $article['previewimage']. '<br />';
                            break;                        
                        }
                        
                        if(!
is_resource($image))
                        {
                            
//resiziing did not work - we are using the fallback image.
                            
$article['previewimage'] = $fallback_img;
                            echo 
'<span style="color:red">Error occurred:</span> imagecreation failed. ' $article['previewimage']. '<br />';
                        }
                        else
                        {
                            
$img_width $imageinfo[0];
                            
$img_height $imageinfo[1];
                            
                            
imagecopyresampled($sprite$image0000$maxwidth$maxheight$img_width$img_height );
                            
imagedestroy($image);

                            
$img_filepath $slider_img_filepath 'slide_' $i '.jpg';
                            
$success imagejpeg($spriteDIR  . ($img_filepath[0] != DIRECTORY_SEPARATOR ?  DIRECTORY_SEPARATOR '') . $img_filepath);
                            
imagedestroy($sprite);
                            if(
$success)
                            {
                                
$article['previewimage'] = $img_filepath;
                            }
                            else
                            {
                                
$img_filepath DIR  . ($img_filepath[0] != DIRECTORY_SEPARATOR ?  DIRECTORY_SEPARATOR '') . $img_filepath;
                                echo 
'<span style="color:red">Error occurred:</span> imagejpeg failed. ' $article['previewimage']. '<br />
                                directory: '
$img_filepath ;
                                
                                
$article['previewimage'] = $fallback_img;
                            }
                        }
                        
                    }
                    else
                    {
                        
//resiziing did not work - we are using the fallback image.
                        
$article['previewimage'] = $fallback_img;
                        echo 
'<span style="color:red">Error occurred:</span> picture is not readable.' $article['previewimage']. '<br /> ';
                    }                  
                }
                else
                {
                    
//resiziing did not work - we are using the fallback image.
                    
$article['previewimage'] = $fallback_img;
                    echo 
'<span style="color:red">Warning:</span> article has no previewimage or sprite is no ressource. ' $article['previewimage']. '<br />';
                }
        

                
/*remove everything from the previewtext - html and bb. I do not want bold or colored text there. Cut to a decent length.*/        
                
$article['pagetext'] = strip_bbcode($article['pagetext'], truetruefalsetruefalse);

                
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
                    
                
$len $description_length;
                if ( 
strlen($article['previewtext']) > $len )
                {                    
                    
$article['previewtext'] = substr$article['previewtext'] , strrpossubstr$article['previewtext'], 0$len), ' ' ));
                }   

                
$i++;
                
//Build Array
                
$article_neu = array();
                
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'$article['title'].'</h2><span>'$article['previewtext'] .'</span> <a rel="nofollow" href="/content.php?r=' $article['nodeid'] . '-' $article['url'] . '">Leggi Tutto...</a>';
                
$article_neu['htmlcaptionname'] = 'htmlcaption' $i ;
                
$article_neu['picture'] = '<a rel="nofollow" href="/content.php?r=' $article['nodeid'] . '-' $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'$i '" /></a>';
                
                
$featured_articles[] = $article_neu;
            }
        }
    }
    
    
//Randomize Array
    //shuffle($featured_articles);

       
$output_bits '
    <link rel="stylesheet" href="' 
.$slider_img_filepath'slider.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="' 
.$slider_img_filepath'slider_uf_theme.css" type="text/css" media="screen" />
    <div style="height:' 
$maxheight 'px;">
    <div id="wrapper">
        <div class="slider-wrapper theme-uf">
            <div class="ribbon"></div>
            <div id="slider" class="nivoSlider">'
;
            
                foreach(
$featured_articles AS $article)
                {
                    
$output_bits .= $article['picture'];
                }
            
$output_bits .= '
            </div>'
;
            
            foreach(
$featured_articles AS $article)
            {
                
$output_bits .= '<div id="' $article['htmlcaptionname'] . '" class="nivo-html-caption">' $article['description'] .'</div>';
            }
            
            
$output_bits .= '         
        </div>

    </div>
    <script type="text/javascript" src="' 
.$slider_img_filepath'jquery-1.6.1.min.js"></script>
    <script type="text/javascript" src="' 
.$slider_img_filepath'jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript">
    $(window).load(function() {
        $("#slider").nivoSlider();
    });
    </script>
    </div>
    '
;
        
$output $output_bits;
        
  echo 
"<table align='center'><tr>"
  echo 
"<td>";

$tabhtml "<div id=\"featured\"><ul class=\"ui-tabs-nav\">".$tabhtml."</ul>";

echo 
$tabhtml.$centerhtml."</div>";
  echo 
"</td>";
  echo 
"</table>"

?>



Thank You

croft 08-11-2011 11:11 AM

I dont have an error per say but it shows up all wrong.
Check the image.

http://www.pdcm.net/slider.gif


All times are GMT. The time now is 09:00 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02100 seconds
  • Memory Usage 1,907KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete