View Full Version : vBulletin CMS Widgets - United-Forum Nivo Slider Widget
Mooff
07-17-2011, 10:00 PM
Based on the Nivo Slider (http://nivo.dev7studios.com/) - all credit for slider awesomeness goes to them. ;)
vB4 implementation goes to me. :D
What it is:
A slider for cms articles, it gets the articles via database, uses (if possible) the previewimage there and resizes it to slider size *update 1.1.0 cropping function included.
Livedemo on a Big Board (>2.000.000 posts) (http://www.united-forum.de/news/)
the nivo slider on our site is customized to fit our heavily customized cms. Default look of this addon is shown in the picture below
https://vborg.vbsupport.ru/attachment.php?attachmentid=131394
facts about the nivo slider
- ~ 600.000 downloads
- 16 transition effects
- a ton of options
- different available themes
- ...
Installation
upload all files (attached zip file) in the folder where you do need them - this has to be the same folder you will set via $slider_img_filepath (see picture)
https://vborg.vbsupport.ru/attachment.php?attachmentid=131195
create a new php-widget and insert the following 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 = 10;
//lengh in characters of the article descriptions
$description_length = 95;
//stretch picture or crop them? false = strechting (default) true = cropping (beta)
$crop = false;
//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 "Strech or Crop? $crop <br />";
echo "show_articles_without_image: ";
var_dump($show_articles_without_image);
echo " <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) .' -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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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)
{
if($debug_modus == true OR !file_exists($slider_img_filepath . 'slide_' . $article['nodeid'] . '.jpg'))
{
//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.
echo '<span style="color:red">Error occurred:</span> imagecreation failed. ' . $article['previewimage']. '<br />';
$article['previewimage'] = $fallback_img;
}
else
{
$img_width = $imageinfo[0];
$img_height = $imageinfo[1];
if($crop == false)
{
imagecopyresampled($sprite, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
}
else
{
//cropping
$ratiox = $maxheight / $img_height ;
$ratioy = $maxwidth / $img_width ;
$new_height = $img_height;
$new_width = $img_width;
if ($maxheight > $img_height OR $maxwidth > $img_width)
{
if($ratiox > $ratioy)
{
$new_height = round($img_height * $ratiox);
$new_width = round($img_width * $ratiox);
}
else
{
$new_height = round($img_height * $ratioy);
$new_width = round($img_width * $ratioy);
}
}
$cropx = $new_height - $maxheight;
$cropy = $new_width - $maxwidth;
imagecopyresampled($sprite, $image, 0, 0, 0, 0, $new_width, $new_height, $img_width, $img_height);
imagedestroy($image);
}
$img_filepath = $slider_img_filepath . 'slide_' . $article['nodeid'] . '.jpg';
$success = imagejpeg($sprite, DIR . ($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.
echo '<span style="color:red">Error occurred:</span> picture is not readable.' . $article['previewimage']. '<br /> ';
$article['previewimage'] = $fallback_img;
}
}
else
{
//resiziing did not work - we are using the fallback image.
echo '<span style="color:red">Warning:</span> article has no previewimage or sprite is no ressource. ' . $article['previewimage']. '<br />';
$article['previewimage'] = $fallback_img;
}
}
else
{
//we already have the image, no need to resize or crop anything
$article['previewimage'] = $slider_img_filepath . 'slide_' . $article['nodeid'] . '.jpg';
}
/*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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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 href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $article['nodeid'] ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $article['nodeid'] . '" /></a>';
$featured_articles[] = $article_neu;
}
}
}
//Randomize Array
//shuffle($featured_articles);
//Debug Messages
if($debug_modus)
{
echo '#articles - featured and databasepull ';
var_dump(count($featured_articles));
var_dump(count($database_articles));
}
$output_bits = '
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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;
if($debug_modus === false)
{
ob_end_clean();
}
set refresh time to something big!
save - add the widget to your layout - enjoy
Custom settings:
At the top of the php-widget code you can see the following:
// 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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
If you change $maxwidth and $maxheight you need to edit the nivo-slider_uf_theme.css file, here:
.theme-uf #slider {
margin:0px auto 0 auto;
width:650px; /* Make sure your images are the same size */
height:250px; /* Make sure your images are the same size */
}
Width and height have to be the same value in your php-widget and in the css file.
In additon to these settings i also included a "value/relevance function". Meaning the slider doesn't show your latest 5 articles, but instead weights them based on age and comments.
As older an article is the less likely it will show up in the slider.
More comments make it more likely.
This behaviour can be easily changed. I didn't include an if condition cause every board has different needs and i don't know whats best for you.
In addition conditions like "articles just from this section - or these sections, or this category, with a minimum of 10 posts" can be included via one single if condition. Again, i don't know what your board needs or what your category names are.
You can also modify the preview length (more words, less words), the preview style (color fontsize, fontweight .... Again different forums different needs. It's highly customizable.
Support:
Support and requests for the slider itself should be asked here http://nivo.dev7studios.com/
Same goes for different slider themes - a lot is possible, even thumbnails - again this is part of the nivo slider and not the vb4 implementation.
If you have any questions regarding the settings - or want different settings (which have to do with vb4) - ask, and i'll try to come up with some code // show you where you have to put what.
Slider not working. No idea why?
You will find a FAQ in the first comment, which will be kept up to date:
FAQ (https://vborg.vbsupport.ru/showpost.php?p=2221916&postcount=2)
The widget here is completely free. No charge, no branding.
But, we do not mind donations either. If you want to give us something. Since we are advertising free and fan based we are happy about every small donation. :)
( On Forumhome bottom right paypal button: http://www.united-forum.de/forum.php )
That's all
Hope it works for you. :)
Regards Mooff
Mooff
07-18-2011, 12:03 PM
Changelog
1.1.0 (8.11.2011)
included a "cache" system for pictures which solves a browser cacheing issue and speeds up the slider (on second image creation) -- added some FAQ questions
included a bit more debug messages
new crop function (beta stadium) included
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
0.9.9 (28.07.2011)
images are now saved as jpg instead of png -> reduced filesize by a factor 10
removed a bug causing weird characters to show up in the previewtext
added loads of debug messages and a debug mode
removed beta status - slider is running on our live site now
0.9.2 (23.07.2011)
fixed a bug which caused the slider to not find attachements
removed the fopen() function. Now checking via a GD function whether given ressource is an image
0.9.1 (21.07.2011)
added $description_length variable
reworked description cutting code. Now using a word sensitive substring function. Cutpoint is easier on the eye now.
removed some slashes '/' in the code which might have caused pictures not beeing shown
changed description title to h2 instead of span - might have a small effect on beeing more seo friendly
removed a bug in the image resizing code (code was wrongly placed outside an else condition)
FAQ
Q: I want a static version. Can you give me some code?
A: Code can be found here: https://vborg.vbsupport.ru/showthread.php?p=2222449#post2222449
Q: I want the slider on FORUMHOME
A: Code that should work can be found here (untested): https://vborg.vbsupport.ru/showthread.php?p=2222907#post2222907
Q: I see only a white Box - no images
A: Probably a jquery issue: https://vborg.vbsupport.ru/showthread.php?p=2224063#post2224063
Q: Captions appear and the slider works, but i can't see images
A:
- See Answer above, it might be a jquery problem.
- Do the images show up in the folder you specified?
- Does the fallback image show up if you set the switch to yes?
Q: Slider isn't working (f.e. I can see text, but no images and no slider functunality)
A:
Make sure the slider_img_filepath variable is set correctly
$slider_img_filepath = 'external/unitedforum/slider/';
If you open such a link in your browser: http://www.mysite.com/$slider_img_filepath/nivo-slider.css you should see the css file!
Q: I want articles from exclusive cms categories or sections
A: Modified database query can be found here: https://vborg.vbsupport.ru/showpost.php?p=2233429&postcount=144
Q: Attachments aren't working for me
A: If your guests do not have the rights to see attachments - neither does the slider.
Q: I want to show specific articles and nothing else
A: Code can be found here: https://vborg.vbsupport.ru/showpost.php?p=2229188&postcount=91
Q: I want to change some nivo slider settings (effects, timings..)
A: An example for timings can be found here:
https://vborg.vbsupport.ru/showpost.php?p=2232204&postcount=132
For other settings please check the nivo slider homepage:
http://nivo.dev7studios.com/#usage
Q: I want the slider without widget title - how to do that?
A: Explanation can be found here: https://vborg.vbsupport.ru/showthread.php?p=2233348#post2233348
A2: No Background at all: Check this post (including pictures) by The Rocketeer https://vborg.vbsupport.ru/showpost.php?p=2241409&postcount=205
Q: How to order the articles shown by date descending - without value sorting function?
A: Take a look at this post: https://vborg.vbsupport.ru/showpost.php?p=2231992&postcount=120
Q: I updated one of my articles but the slider shows the old picture?
A: Thats the new cache function. Either delete all slide images in the slider folder or run the slider one time in debug mode.
Q: Can i have different pictures in the slider and as a preview?
A: That's now possible via the cache system. Just upload the picture you want to have in the slider into your slider folder, nameing convention is: slide_articleID.jpg. Be aware that those images will be overwritten in debug mode.
Q: I have more and more slider pictures in my slider folder?
A: Again cache system. Each article which was in the slider one time creates an unique picture. The slider does not delete those pictures, in order to be able to use the cache functionality. Please delete them manually from time to time if you do not want them there.
Q: Slider is not working and Firebug is giving me an "#slider is empty" error?
A: Solution can be found here: https://vborg.vbsupport.ru/showpost.php?p=2268535&postcount=331
[b]Q: My question wasn't answered in this FAQ :(
A: Please set the slider into debug mode via $debug_modus = true;
You then should see debug messages, which might point you in the right direction.
If that doesn't help. Post in the thread and please provide above debug and very detailed information what doesn't work and what you want.
Loversama
07-18-2011, 02:41 PM
I have the original slider installed on my website and was thinking to myself "if only someone could integrate this into my forums" and here it is..
Well done, I am a little confused about the instructions at the moment, but if that could be made more clear I think I could 5 Starr this plugin!
Sage Knight
07-18-2011, 03:11 PM
Great job, I have yet to actually test it, but so far it looks good. Thank you.
One question we have to manually add the images? And if we only want certain effects what should we do?
Mooff
07-18-2011, 03:34 PM
I updated the installation information and custom settings on top a bit.
Please give feedback if i'm unclear in the description, so i can change it.
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.
If you want certain effects you have to edit the nivo slider options:
http://nivo.dev7studios.com/
Usage tab - options, there is an explanation given.
apn3a
07-18-2011, 05:45 PM
Does this perfect script works with vb advanced ?
Mooff
07-18-2011, 06:08 PM
I do not own vb_advanced. Therefore i have no idea.
Since the db_query is build upon the vb4-cms article database/table structure i have to go with "probably not". Maybe an experienced coder who does have vb advanced can clearify on that one.
Lazorbeam
07-18-2011, 07:14 PM
Awesome :).
I have a couple questions...
1 - Is it possible to have the posts pulled from a forum instead of CMS (seems like it would need some rewrite)?
2 - Is it possible to have, say, 5 articles that are static and nothing else? I'd like to show users 5 "must read" pages instead of shuffling through new ones.
3 - Is this certified 4.1.3 because you got it running on this VB version? Is it not working with 4.1.4?
Edit: http://nivo.dev7studios.com/#usage shows how to customize the slides manually.
Mooff
07-18-2011, 07:36 PM
If you want static articles then you don't need 90% of the code:
Without testing! - Include into a static html widget: (height setting on div style="heigth needs your number in it)
<link rel="stylesheet" href="/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="link to your article"><img src="yourpreviewpicture" alt="" title="#htmlcaption1" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>article title</b> </ br> example description of article <a href="link to your article">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="clientscript/jquery/jquery-1.4.4.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>
That would show 1 static article - you have to insert the link to your article, the previewimage and the description.
(additional examples are in the demo folder, when you download the nivo slider from their homepage)
Version is 4.1.3 since we will jump 4.1.4 and install 4.1.5 next. I'm pretty sure it will work with 4.1.4 (the static version will work like 100% with 4.1.4) - but i can't verify it - so i won't say it does.
Regards
Gemma
07-18-2011, 11:20 PM
Very nice work. Thanks a lot :)
Lazorbeam
07-19-2011, 01:32 PM
I'm having trouble getting the slider to work (static version posted above). Here's the code I used;
<link rel="stylesheet" href="/nivo/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/nivo/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="/nivo/1Test.png" alt="" title="#htmlcaption1"
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>Items that should be on your snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="/clientscript/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/nivo/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
Note, the page already loads jquery 1.4.2 for TWS notifications. Does this have any implications?
Here's the test page where I've tried to load the widget: http://consortium.stormspire.net/content.php?11-About-The-Consortium
Mooff
07-19-2011, 01:48 PM
Img tag is not closed.
<link rel="stylesheet" href="/nivo/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/nivo/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="nivo/1Test.png" alt="" title="#htmlcaption1" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>Items that should be on your snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="/clientscript/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/nivo/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
try this one.
Ah i see, was my blunder in the code above - sorry
Edit:
If you have jquery 1.4 or higher allready running on your site you can delete that line:
<script type="text/javascript" src="/clientscript/jquery/jquery-1.4.4.min.js"></script>
Lazorbeam
07-19-2011, 02:29 PM
Img tag is not closed.
<link rel="stylesheet" href="/nivo/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/nivo/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="nivo/1Test.png" alt="" title="#htmlcaption1" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>Items that should be on your snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="/clientscript/jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/nivo/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
try this one.
Ah i see, was my blunder in the code above - sorry
Edit:
If you have jquery 1.4 or higher allready running on your site you can delete that line:
<script type="text/javascript" src="/clientscript/jquery/jquery-1.4.4.min.js"></script>
Fantastico. Looks like it's working. As you pointed out I needed to remove the line that calls jquery.
Next step is to add additional slides. I tried duplicating some code but failed miserably.
Also, it seems that the arrows are somewhat pixelated. Do the "overlay" graphics look normal to you?
Link again for convenience: http://consortium.stormspire.net/content.php?11-About-The-Consortium
Edit: Hang tight, I'll first go through the nivo site and see if I can fix my own problem.
Mooff
07-19-2011, 02:48 PM
Also, it seems that the arrows are somewhat pixelated. Do the "overlay" graphics look normal to you?
No, they do not. I uploaded the wrong png by mistake in the zip file. New version is up, should look better.
ah well, since i'm typing anyway :p
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="nivo/1Test.png" alt="" title="#htmlcaption1" /></a>
<a href="http://consortium.stormspire.net"><img src="nivo/2Test.png" alt="" title="#htmlcaption2" /></a>
<a href="http://consortium.stormspire.net"><img src="nivo/3Test.png" alt="" title="#htmlcaption3" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>Items that should be on your snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
<div id="htmlcaption2" class="nivo-html-caption">
<b>Items that should be on your second snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
<div id="htmlcaption3" class="nivo-html-caption">
<b>Items that should be on your third snatch list</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
Lazorbeam
07-19-2011, 02:49 PM
For anyone looking to add slides to static pages, add the following bold code;
<link rel="stylesheet" href="/nivo/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/nivo/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="/nivo/1Test.png" alt="" title="#htmlcaption1" /></a>
<a href="http://consortium.stormspire.net"><img src="/nivo/2Test.png" alt="" title="#htmlcaption2" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>First slide..</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
<div id="htmlcaption2" class="nivo-html-caption">
<b>Second slide..</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="/nivo/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
You also need to rename htmlcaption1 to htmlcaption2.
Alfa1
07-20-2011, 03:26 AM
Im only getting the date, but no slider. Im using the code in the 1st post.
Mooff
07-20-2011, 08:27 AM
Per default the execution code in a cms-php widget is returning the date.
After you create the widget you have to click on "Configure" on the right and insert my code.
edit: let me clarify that one.
You have to delete that code, which is in there by default:
$output = date(vB::$vbulletin->options['dateformat']) . "<br />\n";
If you post additional code below that line nothing will happen. It just takes the output value - and doesn't even evaluate the rest.
starman?
07-20-2011, 01:52 PM
This would be awesome if I could get it to work. I get the title and text from the article but no images. I've followed your instructions precisely and have tried different sized images and still only the title and text shows. Any ideas?
Mooff
07-20-2011, 02:05 PM
Some ideas:
set the fallback image switches to true:
$show_articles_without_image = true;
$fallback_img = 'external/unitedforum/slider/uf_fallback_slider.png'; //path to an existing picture
If the images show up we at least know the slider is working correctly and the bug is somewhere in the vb4 implementation
the images are resized using the php GD package (vbulletin does support both GD and ImageMagick) - the slider currently has no ImageMagick support. Do you have the GD package installed?
comment out the first and the last line
//ob_start();
//ob_end_clean();
You will then see error messages and warnings (given there are some), once you load the cms page where your slider is active. Please send me this output.
starman?
07-20-2011, 02:42 PM
GD already installed. I've done all the other changes you have suggested and still the same. Title and text - no image. No error messages or warnings.
Mooff
07-20-2011, 02:48 PM
Neither the fallback image nor an error? That's really strange.
Please link me to your test site - if that's not possible please include a var_dump here:
old:
//Randomize Array
//shuffle($featured_articles);
new:
//Randomize Array
//shuffle($featured_articles);
var_dump($featured_articles);
given you still have ob_start(); and ob_end_clean(); commented out you should see a lot of debug information.
HellRZR
07-20-2011, 02:49 PM
Nice mod, can it be changed or modified easily to do the following. Pull the cms articles and display them on the forum home instead?
starman?
07-20-2011, 03:09 PM
After adding the var_dump, I get a browser error in FF5.0 -
Content Encoding Error - The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
and a can't load page error in IE9.
Thanks for your help so far.
Mooff
07-20-2011, 03:40 PM
@HellRZR, should be pretty easy.
Without testing the way it might/should work.
Plugin Hook Location: i don't know, has to be an early one for FORUMHOME.
maybe: process_templates_complete ?
Create a plugin, insert the code, at the end of the code add:
$templater = \vB_Template::create('nivo_slider');
$templater->register('output', $output);
$template_hook['insertAsensibleHookHere'] .= $templater->render();
as template_hook you have to use the place where it should show up (search through the forumhome template for template hooks and choose one.
Then create a template named nivo_slider and insert
{vb:raw output}
It then should show up.
@starman
Damn. I'm kinda lost now. Without debug message it is basecially guesswork. :(
Let's try this: Remove that var_dump again and send me the source code of your slider cms-page you get viewing it via firefox5.0 ( ctrl+u) starting at: "
<link rel="stylesheet" href="' .$slider_img_filepath. '/nivo-slider.css" type="text/css" media="screen" />
...
until: <script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
Maybe i'll see something there.
Alfa1
07-20-2011, 04:25 PM
Per default the execution code in a cms-php widget is returning the date.
After you create the widget you have to click on "Configure" on the right and insert my code.
edit: let me clarify that one.
You have to delete that code, which is in there by default:
$output = date(vB::$vbulletin->options['dateformat']) . "<br />\n";
If you post additional code below that line nothing will happen. It just takes the output value - and doesn't even evaluate the rest.
That code is removed and replaced by your code. Yet the date still shows. When I refresh the page it goes away, but upon refreshing again its there again. :confused:
Sometimes when refreshing, I get this error:
Parse error: syntax error, unexpected '&' in /packages/vbcms/widget/execphp.php(191) : eval()'d code on line 17
or
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /packages/vbcms/widget/execphp.php(191) : eval()'d code on line 14
mitch84
07-20-2011, 04:42 PM
thank you, work fine, installed in two minutes, great work!;)
Mooff
07-20-2011, 04:48 PM
@mitch84
Thanks for the feedback. Allways nice to hear when it is working. :)
@Alfa1
I have no idea what's broken there. Doesn't sound like a mistake in my code. Do you have other php widgets running? Do they produce similar errors?
starman?
07-20-2011, 04:50 PM
PM sent
Alfa1
07-20-2011, 05:10 PM
@mitch84
Thanks for the feedback. Allways nice to hear when it is working. :)
@Alfa1
I have no idea what's broken there. Doesn't sound like a mistake in my code. Do you have other php widgets running? Do they produce similar errors?
I have one other php widget running, but that does not produce any error.
Morpheus NS
07-20-2011, 07:25 PM
Is it possible to make it work for 4.1.1? I followed your instructions, but all I get is the white background.
Edit: Nevermind, I just made it work. But, here is another problem. It shows only fallback image...
Mooff
07-21-2011, 11:39 AM
0.9.1 (21.07.2011)
added $description_length variable
reworked description cutting code. Now using a word sensitive substring function. Cutpoint is easier on the eye now.
removed some slashes '/' in the code which might have caused pictures not beeing shown
changed description title to h2 instead of span - might have a small effect on beeing more seo friendly
removed a bug in the image resizing code (code was wrongly placed outside an else condition)
@Morpheus NS
Your issue could be the slashes. Meaning the path ending up at /http/slider//picture.jpg which could break it. Please try 0.9.1.
If that isn't the problem check whether the pictures are saved in the folder you chose and if you can look them up manually in your browser.
Alfa1
07-22-2011, 05:53 AM
The new version work much better for me. No more errors and I now see titles and text. No images yet though. If I outcomment the 1st and last line, then I get these errors:
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen(http://www.mysite.org/attachment.php?attachmentid=79&cid=18) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen(http://www.mysite.org/attachment.php?attachmentid=90&cid=18) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen(http://www.mysite.org/attachment.php?attachmentid=93&cid=18) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen() [function.fopen]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Warning: fopen(http://www.mysite.org/attachment.php?attachmentid=92&cid=18) [function.fopen]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 110
Mooff
07-22-2011, 09:24 AM
We are using the fopen() function to check whether the file does still exist on the external server before we start our image manipulation.
Seems like url file access is blocked on your server. I don't know whether this is done via your provider or if you can switch it on in your php.ini
http://www.php.net/manual/en/filesystem.configuration.php
That would be your first option.
Second option ist to replace this code:
$filehandle = fopen($article['previewimage'], 'r');
if(is_resource($filehandle))
{
fclose($filehandle);
with the curl based file check (your server needs to have cUrl for that.
$can_open_file = false;
if(strpos($article['previewimage'], 'http://') === false)
{
$can_open_file = is_readable($article['previewimage']);
}
else
{
// initialize a new curl resource
$ch = curl_init();
// set the url to fetch
curl_setopt($ch, CURLOPT_URL, $article['previewimage']);
//exclude the header
curl_setopt($ch, CURLOPT_HEADER, FALSE);
//exclude the body
curl_setopt($ch, CURLOPT_NOBODY, TRUE);
// return the value instead of printing the response to browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
//take the content as a instance
//$filehandle = curl_exec($ch);
if(!curl_errno($ch))
{
$can_open_file = true;
}
curl_close($ch);
}
if($can_open_file)
{
If that doesn't work you can try to ignore the file_check and see if the GD url access isn't blocked (like fopen() is).
So the third option would be:
Replace
$filehandle = fopen($article['previewimage'], 'r');
if(is_resource($filehandle))
{
fclose($filehandle);
with
if(true)
{
If that doesn't work i'm out of options.
P.S.: On my testsite i have the curl option running right now.
Alfa1
07-22-2011, 05:51 PM
Yes, fopen is blocked on purpose due to the major security risks involved. Curl is active though, so that should work. But for some reason it doesn't. Would you mind checking it out?
Mooff
07-23-2011, 08:03 AM
Please check if the folder you specified here:
$slider_img_filepath = 'external/unitedforum/slider/';
is writeable and whether the addon does save slides in there.
Alfa1
07-23-2011, 03:01 PM
Its 777 writable, but the addon does not save anything.
Mooff
07-23-2011, 03:24 PM
Oh geez i'm so stupid. It doesn't work with attachments right now - i'll fix that bug and post a new version later today.
Alfa1
07-23-2011, 03:44 PM
Thanks!
Mooff
07-23-2011, 03:50 PM
0.9.2 (23.07.2011)
fixed a bug which caused the slider to not find attachements
removed the fopen() function. Now checking via a GD function whether given ressource is an image
There you go - code in first post updated.
That should do the trick. =)
SECTalk.com
07-23-2011, 07:44 PM
Add-on works insofar as it resizes the images and writes them into the folder. It also displays the little background image. But it won't display anything else.
Any ideas?
When I comment out the first and last lines, same thing. No errors.
Thanks
Mooff
07-23-2011, 08:24 PM
two possibilities come to mind:
a) you do not have the jquery1.4.4.js file in the vbulletin folder
This would mean search
<script type="text/javascript" src="clientscript/jquery/jquery-1.4.4.min.js"></script>
and replace with
<script type="text/javascript" src="' .$slider_img_filepath. 'jquery-1.6.1.min.js"></script>
b) you already have a jquery version running on the page where the slider is included.
Just delete that line. Two jquery files on one page are unnecessary and unfortunately break the jquery execution.
<script type="text/javascript" src="clientscript/jquery/jquery-1.4.4.min.js"></script>
If the jquery version you are using on your website is above 1.4 - you are fine and everything should be working now.
If it isn't - update your version.
Alfa1
07-23-2011, 09:31 PM
0.9.2 (23.07.2011)
fixed a bug which caused the slider to not find attachements
removed the fopen() function. Now checking via a GD function whether given ressource is an image
There you go - code in first post updated.
That should do the trick. =)
Im afraid not. :s
SECTalk.com
07-24-2011, 01:02 AM
Thanks, I had multiple (about five or 6) instances of jQuery running.
Aramist
07-24-2011, 05:09 PM
Same to me =/
Everything work fine....except images, that dont appear.
=/
Mooff
07-24-2011, 05:21 PM
Sorry Alfa1, i'll check that attachment issue more thouroughly sometime next week when our new cms is finally live.
@ Aramist
- please check out post #41 maybe it's a javascript thing
- or are your article images attachments
- or do the images show up in the folder you specified
- or does the fallback image work if you set this switch on yes
I'll rewrite the first post sometime around tuesday, clean it up a bit and provide a (hopefully) usefull faq in the first comment.
Aramist
07-24-2011, 05:45 PM
- please check out post #41 maybe it's a javascript thing
I've already done that
- or are your article images attachments
no
- or do the images show up in the folder you specified
the folder i've specified keeps empty..
- or does the fallback image work if you set this switch on yes
It works fine
I'm sure the problem is in the image creation, cause your condition to use a sample image in case the image creation fail is working.
But i haven't figured out why... =/
=/
Ty
Mooff
07-24-2011, 05:57 PM
Do you have php GD installed?
Is the folder you've specified writeable?
If both answers are yes please comment out //ob_start(); and //ob_end_clean()
and post the debug message, if there is one.
Aramist
07-24-2011, 06:03 PM
Ohhh...how stupid I am..
I had removed
//picture width and height !same as in the CSS FILE!
$maxwidth = 650;
$maxheight = 250;
that was the problem...now works fine
Good jog !!
Other question:
How can i point the DB query to get article from one exclusive cms category?
Ty a lot man :D
Mooff
07-24-2011, 06:17 PM
Great to hear that. =)
category or section?
i'll write down the category code (untested)
$query = sprintf("
SELECT
article.pagetext,
article.previewimage,
node.url,
node.publishdate,
node.parentnode,
parentnode.url AS parenturl,
thread.replycount,
info.title,
node.nodeid
FROM
".TABLE_PREFIX."cms_article AS article INNER JOIN
".TABLE_PREFIX."cms_node AS node
ON (node.contentid = article.contentid AND node.contenttypeid = '%d') 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
WHERE
nodecategory.categoryid = X AND
node.setpublish = 1 AND
node.publishdate > '%d' -34560000
ORDER BY node.publishdate
ASC LIMIT 20"
,$article_type,$time);
that X in
nodecategory.categoryid = X AND
is your categoryid - you have to look that one up. For example:
/content/category/31-esport.html
Category esports on our site has the ID 31.
in addition, delete that line:
$categories = explode(',' , $article['GROUP_CONCAT( category.category )']);
Aramist
07-24-2011, 06:28 PM
Oh TY !
I had to include category.categoryid in select option.
Now works like a charm !!
TY a lot Dude!
5 star rated for the mod and for the support!
Aramist
07-24-2011, 06:58 PM
@ another questions :P
1 - I'm getting some charset issues on caption, I use UTF-8, but some captions are coming wrong...but original posts are ok, no issues....just on slider caption.
Edit: Just preview text are getting worng, post title is charset ok.
2 - I have verified that slide images are been created with ~200 or 300k, which is causing the slider to stuck some animations (while loading the images). Is there any way to reduce images file size?
Ty
Mooff
07-24-2011, 07:12 PM
first one. Won't have time to debug that until next week. However, please give more information (what characters are the issues, what they are in your original posts -quote that part- and what they are in the caption, another quote).
second one. Sure, will be included in the next version - i used parts of the sprite code Osbes wrote for our css-sprite performance addon. There we do need transparency, so the images are saved as *.png
For the nivo slider *.jpg does make more sence and jpegs are alot smaller.
This part
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.png';
$success = imagepng($sprite, DIR . ($slider_img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
will be changed into this one (already implemented our version)
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($slider_img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
Brexen
07-24-2011, 09:03 PM
Thanks man nice :D installed <3
Aramist
07-25-2011, 02:38 PM
first one. Won't have time to debug that until next week. However, please give more information (what characters are the issues, what they are in your original posts -quote that part- and what they are in the caption, another quote).
second one. Sure, will be included in the next version - i used parts of the sprite code Osbes wrote for our css-sprite performance addon. There we do need transparency, so the images are saved as *.png
For the nivo slider *.jpg does make more sence and jpegs are alot smaller.
This part
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.png';
$success = imagepng($sprite, DIR . ($slider_img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
will be changed into this one (already implemented our version)
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($slider_img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
This change works great ! TY....down to 20k from 200k.
Explaining MY charset Issue:
In a Original text: " Redu??o " and " implica??es "
It shows: " Redução " and " implicações "
But it only occurs in the caption $article['previewtext'] variable .
$article['title'] variable is working fine with no charset issues.
One Question: What happens if I edit the original article and change the image? The script can handle it?
And no problem with the support time....u can help me when u have time...don't worry ! :D
Ty for your support ! :D
Mooff
07-25-2011, 03:26 PM
Ah i see, the issue seems to be my version of equalizing the preview text length (which i changed numerous times along the way). Thought it would work for everything since it does work with the german special characters ? ? ? and so on.
Anyways, quick and dirty fix would be removing the equalizing part (preview length then might differ depending on how many special characters are in there, but everything should look fine then)
again, untested
/*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'], true, true, false, true, false);
$article['pagetext'] = strip_tags($article['pagetext']);
$article['previewtext'] = str_replace('<br />', '', $article['pagetext']);
$article['previewtext'] = html_entity_decode($article['previewtext']);
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $article['previewtext'], 0, $len), ' ' ));
}
$article['previewtext'] = htmlentities($article['previewtext']);
changes into
/*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'], true, true, false, true, false);
$article['pagetext'] = strip_tags($article['pagetext']);
$article['previewtext'] = str_replace('<br />', '', $article['pagetext']);
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $article['previewtext'], 0, $len), ' ' ));
}
--
your other question.
The slider can handle that.
If you edit an article the next time the cms widget cache runs out the new version will be in. By the way i would strongly advise to use the widget cache on this one. Default setting there is 5min - the widget cache for the slider refreshes every 300 minutes on our website. Using the cache the load time is blazing fast. Letting the database query run, sort the articles and then resize and save a bunch of images is not so fast. ;)
Aramist
07-25-2011, 04:47 PM
Ah i see, the issue seems to be my version of equalizing the preview text length (which i changed numerous times along the way). Thought it would work for everything since it does work with the german special characters ? ? ? and so on.
Anyways, quick and dirty fix would be removing the equalizing part (preview length then might differ depending on how many special characters are in there, but everything should look fine then)
again, untested
changes into
/*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'], true, true, false, true, false);
$article['pagetext'] = strip_tags($article['pagetext']);
$article['previewtext'] = str_replace('<br />', '', $article['pagetext']);
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $article['previewtext'], 0, $len), ' ' ));
}
Again..... works like a charm !!! :D
Ty a lot..
Now i'll sit here and wait you bring us the next version with attach working !! :DD
A Stunning Job ! Gratz !
BTW ... Nominated !
Ty
Mooff
07-27-2011, 09:31 AM
Update on Attachements:
I tried debugging it today, but unfortunately run into a huge bug our CMS has. It does not show attached images at all. Neither preview, nor inline, nor in the attachement box. Pictures which are working fine in the forum. Instead it sends our server into some kind of loop, until it ends up with a 503 minutes later...
Without working CMS attachements i can't test the slider code for it.
Doing some searching in the jira vbulletin bugtracker it does look like this might be fixed in 4.1.4 / 4.1.5 - so i'll look into it again once we have updated our forum to that version.
Meanwhile the slider is now running fine on our main cms page and i'll include the jpg/png and charakter encoding stuff soon.
Alfa1
07-27-2011, 05:22 PM
Unless you are 100% sure that the same issue already exists in JIRA, please add a new JIRA report, so that we are sure that the issue is in JIRA.
Mooff
07-27-2011, 06:09 PM
Seems to be that issue:
http://tracker.vbulletin.com/browse/VBIV-5661
( has been there since vb4.0.2 :/ )
Mooff
07-27-2011, 10:06 PM
Osbes managed to sort that attachment bug out on our site.
-> new version added
0.9.9 (28.07.2011)
images are now saved as jpg instead of png -> reduced filesize by a factor 10
removed a bug causing weird characters to show up in the previewtext
added loads of debug messages and a debug mode
removed beta status - slider is running on our live site now
Attachments are working fine for us now. Important point: Guests need to be able to see them, if they can't neither can the slider.
Reworked the FAQ.
Next version will be uploaded once we've upgraded our board to 4.1.5 (given the upgrade calls for slider changes).
Aramist
07-27-2011, 10:40 PM
Nice ! :D
Crotan
07-28-2011, 02:09 AM
No go for me, appears to be grabbing articles fine but it displays them all at once and with no images.
https://vborg.vbsupport.ru/external/2011/07/8.png
Mooff
07-28-2011, 07:30 AM
Please go through the FAQ in the first comment.
It looks like the path in the php-code isn't set to where you did upload the files. Or it might be a jquery problem.
starman?
07-28-2011, 03:45 PM
<script type="text/javascript" src="clientscript/jquery/jquery-1.4.4.min.js"></script>
Did you see this? It's the wrong version and isn't pointing to the folder where nivo is.
Mooff
07-28-2011, 03:54 PM
It's pointing to a vbulletin jquery file in the clientscript folder. I'm going to change that in the next version though, since vbulletin does replace the file with an up to date jquery file in 4.1.5.
Alfa1
07-29-2011, 12:36 AM
Are the instructions in the 1st post up to date now?
Mooff
07-29-2011, 07:09 AM
Yes and in the first comment is a faq which should be read if something doesn't work.
Gemma
07-29-2011, 10:26 AM
Thanks for the updates, great work and support :)
Aramist
07-30-2011, 07:11 AM
Hi Mooff !
When i set an article to be published in a future day, slider show this article (cause i set published = yes)..
It should avoid "not really published yet" articles.
I didn't figured out how to solve this.
Any clue?
ty in advance
Mooff
07-30-2011, 07:51 AM
Thanks for mentioning it, totally forgot about that cms feature since we don't use it. :D
Will fix it in the next version. Until then (untested):
old:
WHERE
node.setpublish = 1 AND
node.publishdate > '%d' -34560000
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20"
,$article_type,$time);
new:
WHERE
node.setpublish = 1 AND
node.publishdate > '%d' -34560000 AND
node.publishdate < '%d'
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20"
,$article_type,$time,$time);
Aramist
07-30-2011, 06:10 PM
Works Fine !!
Ty again Dude !
Cya
The Rocketeer
07-31-2011, 02:52 PM
great work on the slider Moof. thank you very much. I have been following the topic since my original post back at the slider request fund gathering topic.
anyhow, i had some questions and suggestions.
1. Are we able to select which articles to display on the slider? maybe have an option in the acp or somewhere so we can just enter the article numbers / ids / urls and it will go get them?
2. Also maybe you could try to enhance it a bit? make it faster and lite so it doesn't end up slowing down our forums(not that it does that but just a suggestion.)
3. Lets say the first image is a verticle rectangle instead of the horizontal one. lets say my articles first image is 200px wide and 500px high but my second image is ideal, 600px wide x 400px high. Can we program it to fetch the second image instead(if the first one is too small and if a second one exists and is bigger / proper size?)
these are some of the many things i wanted to ask and suggest, i hope you'd have a look through them all. :)
Mooff
07-31-2011, 03:30 PM
thanks
1.
Yes, that is possible. Actually this is kinda running on our board. We are using a hybrid system where a) a maximum of 2 articles per section are added into the slider b) tournaments (from our self coded tournament system) gain a value-bonus c) an extra query in a special database checks whether the article should be in there definitely or not at all d) articles are not allowed to be older than 40 days. All points are interconnected via the value function and it probably will be extended if the vbseo like system we activated today is used sensible by our users.
What a board needs there is highly dependend on the board itself. So i won't add something like this as default behaviour. In addition if you just want 'those' articles and nothing else the database query can be optimized for that need.
Long story short, as said in the first topic. If someone wants a customized query i need to know what exactly they want and i can try to come up with some code for it. No promises though. =) (these special queries will then be linked in the FAQ in post two, a category based one is allready in there, so as a work around you could use that one and add the articles you need in there, or remove them when the time comes for that).
2. The slider is blazing IF it can load all data out of the cms cache system - and i can't speed that one up*. Running the database query and saving pictures and rebuilding the output is not that fast. But, that does not have to be done often. Considering point 1, you want only articles in there which you specify in the code, you don't need it to update at all. So set the cache time for the slider to over 9000 (well or more). And rebuild it (clear cms cache) every time you change the article ids.
3. As for preview pictures. I won't comment on that one until i know what vbulletin changed in 4.1.5 (jira said they are doing something to preview pictures).
*well not in this addon anyway ;)
The Rocketeer
08-01-2011, 05:35 AM
thanks
1.
Yes, that is possible. Actually this is kinda running on our board. We are using a hybrid system where a) a maximum of 2 articles per section are added into the slider b) tournaments (from our self coded tournament system) gain a value-bonus c) an extra query in a special database checks whether the article should be in there definitely or not at all d) articles are not allowed to be older than 40 days. All points are interconnected via the value function and it probably will be extended if the vbseo like system we activated today is used sensible by our users.
What a board needs there is highly dependend on the board itself. So i won't add something like this as default behaviour. In addition if you just want 'those' articles and nothing else the database query can be optimized for that need.
Long story short, as said in the first topic. If someone wants a customized query i need to know what exactly they want and i can try to come up with some code for it. No promises though. =) (these special queries will then be linked in the FAQ in post two, a category based one is allready in there, so as a work around you could use that one and add the articles you need in there, or remove them when the time comes for that).
2. The slider is blazing IF it can load all data out of the cms cache system - and i can't speed that one up*. Running the database query and saving pictures and rebuilding the output is not that fast. But, that does not have to be done often. Considering point 1, you want only articles in there which you specify in the code, you don't need it to update at all. So set the cache time for the slider to over 9000 (well or more). And rebuild it (clear cms cache) every time you change the article ids.
3. As for preview pictures. I won't comment on that one until i know what vbulletin changed in 4.1.5 (jira said they are doing something to preview pictures).
*well not in this addon anyway ;)
Thanks Mooff,
1. So yes, as for the customized query, What I am wanting is not a category based one but maybe an option with a YEs / No and a box somewhere in the Admin CP so we can login and click that option, set it to yes(?) and enter article ID's numbers with commas (,) eg, 178,162,78 and it will only show those articles.
2. Yes, exactly, I want to spesify the articles that should be displayed on the slider, so I dont need it to automatically update anything as I will probably do it myself once every couple of weeks depending on which article I want to feature. So some instructions on that would be great, as we can probably cut down some database querys etc.
3. No proiblem we will see that later on,
But at the moment the first and second feature is what I and a lot of others could really use to define what articles we want to display manually. Hope you can look into it and post some instructions on your second post / F.A.Q for us. Really looking forward to this, so please let me know or if I sounded a bit confusing. :D
Thanks again and do let me know :)
The Rocketeer
08-02-2011, 12:51 AM
I'm getting this error Mooff :(
// DEBUG MODUS ! $debug_modus = false; if($debug_modus === false) '
Mooff
08-02-2011, 06:37 AM
On first glance it looks like you are using the wrong widget type. Html static instead of php execute.
Please check (or create a new widget) from type php execution and insert the code again.
The Rocketeer
08-02-2011, 10:26 AM
Thanks, Looks like I missed that one. Seems to be okay now, But its using the fallback image, its not pulling images from the articles? something I missed ? (Sorry, but I cant seem to get much help from the FAQ I am afraid.) :(
Mooff
08-02-2011, 10:50 AM
Last question. :P
Q: My question wasn't answered in this FAQ
A: Please set the slider into debug mode via $debug_modus = true;
You then should see debug messages, which might point you in the right direction.
If that doesn't help. Post in the thread and please provide above debug and very detailed information what doesn't work and what you want.
Debug will help me a great deal finding out what's amiss. :D
As for the specific articles. I will rewrite the query to account for that, basecially i know what to do, but i can't type that out of my head and give it to you untested. Should find some time during the next days for that.
The Rocketeer
08-02-2011, 10:59 AM
Hahaha lol :D
looks like I missed that one too, :p here is the debug code I got..
DEBUG MODE is ON!
slider_img_filepath: public_html/frontpage_nivo_slider/
width: 650 height: 250
show_articles_without_image:
fallback_img: public_html/frontpage_nivo_slider/uf_fallback_slider.png
#img: 5
description_length: 95
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/public_html/frontpage_nivo_slider/slide_0.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 165
Mooff
08-02-2011, 11:13 AM
The folder public_html/frontpage_nivo_slider/ is not writeable for the user/group your webserver is in.
chmod777 that directory and it should work.
The Rocketeer
08-02-2011, 11:16 AM
But Mooff, It is chmoded to 777, i even went in and set all the files and directorys(if any) inside that folder and made sure everything inside was also 777 and still didnt work :eek:
Mooff
08-02-2011, 11:44 AM
I added 2 additional lines of debug in the code below.
But before you try them i have an idea.
Set: public_html/frontpage_nivo_slider/
To: frontpage_nivo_slider/
// 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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
//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 />';
}
$query = sprintf("
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 = '%d') 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 > '%d' -34560000
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20"
,$article_type,$time);
$article_get = vB::$db->query_read($query);
$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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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 href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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="clientscript/jquery/jquery-1.4.4.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;
if($debug_modus === false)
{
ob_end_clean();
}
The Rocketeer
08-02-2011, 11:52 AM
I added 2 additional lines of debug in the code below.
But before you try them i have an idea.
Set: public_html/frontpage_nivo_slider/
To: frontpage_nivo_slider/
// 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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
//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 />';
}
$query = sprintf("
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 = '%d') 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 > '%d' -34560000
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20"
,$article_type,$time);
$article_get = vB::$db->query_read($query);
$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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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 href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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="clientscript/jquery/jquery-1.4.4.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;
if($debug_modus === false)
{
ob_end_clean();
}
ah magnifico! I just changed it to frontpage_nivo_slider/ and the images are appearing perfectly! a bit choppy but perfect! Thank you mooff. I will come back tomorrow and give you even more ideas to improve this mod! :o
Reycer
08-03-2011, 12:29 AM
It brought IE9 to a complete stop and it froze. Can someone else take a look using IE and see if it loads slow for them? The transitions don't seem to work as well either in IE. Here's a link to my forum. (http://www.schoolbusforums.com)
Mooff
08-03-2011, 10:33 PM
Just checked on our 4.1.5 testboard.
Slider is running fine. The CMS changes do not affect it at all. I'll update the code tomorrow (to account for the different 4.1.5 jquery file) and probably also take a shot at the article id query.
Sidenote: Sorry to all guys who tried out the livedemo link the last few days. We changed our cms rewrite rule from /content/ to /news/ and i forgot about the link in here, which unfortunally redirected you to our forum instead our cms page. Therefore not showing you the slider livedemo. It's fixed now, so if you want to take a look, feel free to do so. =)
Sm1th146
08-03-2011, 11:54 PM
I'm sorry but I have to ask. I installed the widget and love the mod but I am struggling to get it to work properly. I turned the debug mode so it's on but yet still can't find the problem. This is the error message I'm getting with the debug mode on.
DEBUG MODE is ON!
slider_img_filepath: http://tokengaming.com/forums/uf_nivo_slider/
width: 650 height: 250
show_articles_without_image:
fallback_img: http://tokengaming.com/forums/uf_nivo_slider/old-tunnel.jpg
#img: 5
description_length: 95
directory /home/tokeng5/public_html/forums
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/http://tokengaming.com/forums/uf_nivo_slider/slide_0.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 166
Error occurred: imagejpeg failed. http://www.tokengaming.com/forums/attachment.php?attachmentid=36&cid=24
directory: /home/tokeng5/public_html/forums/http://tokengaming.com/forums/uf_nivo_slider/slide_0.jpg
Mooff
08-04-2011, 08:02 AM
Hi, the addon can't write files via a http connection, so slider_img_filepath has to be local.
In your case uf_nivo_slider/ seems to be the right path for $slider_img_filepath instead of http://tokengaming.com/forums/uf_nivo_slider/
MikalMirkas
08-04-2011, 08:26 AM
Hello, I'm having an issue. It isn't pulling images from any articles... (even though there aren't any, still doesn't scroll through the articles)
// 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 = '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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
//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 />';
}
$query = sprintf("
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 = '%d') 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 > '%d' -34560000
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20"
,$article_type,$time);
$article_get = vB::$db->query_read($query);
$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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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 href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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="clientscript/jquery/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;
if($debug_modus === false)
{
ob_end_clean();
}
is my "PHP Direct Execution" Widget. Halp?
Running on 4.1.5.
Edit:
Here's my Debug Code:
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image:
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/prknigh1/public_html/forum
Double Edit: Since you own UF, how do you get your widgets without a border and title? Thanks.
Mooff
08-04-2011, 09:28 AM
Titles were removed via template edits. Find the template for the php execution widget (name starts with vbcms_widget_ ) you will find the right one then.
search and delete
<div class="cms_widget_header">
<h3><img src="{vb:stylevar imgdir_misc}/php.png" alt="" /> {vb:raw widget_title}</h3>
</div>
Warning! This does delete the title on all your php widgets. Not just the slider.
You then have to rewrite your other widget to account for that and include the title there.
(of course you also could create a new template for the slider, modify that to your needs and tell the slider executing php widget via the vbcms configuration in the acp to use the other template)
As for borders and optical appearance of our cms. I think most of it can be done via stylevars. I'm not sure anymore since in some places i had to brutally take stabs at the vbcms.css file or include some custom css classes into the additional.css
As for your problem, not sure. Everything looks fine, no debug errors given. I need additional debug and a link to a testsite would be great.
search
//Randomize Array
//shuffle($featured_articles);
replace
//Randomize Array
//shuffle($featured_articles);
echo '<pre>';
var_dump($featured_articles);
echo '</pre>';
Run that in debug mode and it is going to give you a huge load of text on top of your page. Send me that text.
Mooff
08-04-2011, 10:32 AM
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).
// 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:
//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).
MikalMirkas
08-05-2011, 03:01 AM
Test Site: www.teabagtheenemy.com/forum/content.php
Debug Mode Text: DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image:
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/prknigh1/public_html/forum
array(0) {
}
Mooff
08-05-2011, 08:09 AM
I see, thanks for the link. :)
First, the switch "show_articles_without_image is set to false" and you do not have articles with images (as far as i can see as a guest) so the slider does show nothing.
Another problem might be the default date range i included, this is set to 40 days. Any article older than that isn't shown. Can be changed easily though.
Secondly, you have 3 jquery files included in the source code of your page. jquery-1.6.1 / jquery.js and jquery-1.3.2min. That does cause problems and you do not need all 3. Reduce this to one (but be sure to use a version above 1.4)
Ramsesx
08-05-2011, 08:21 PM
Great stuff Mooff, thanks for it, do you have a hint how I can get the slider aligned left?
See here (http://www.abunto.de/). Thanks.
Mooff
08-05-2011, 08:37 PM
search for this code in the nivo-slider_uf_theme.css file
.theme-uf #slider {
height: 290px;
margin: 0 auto;
width: 470px;
}
replace with
.theme-uf #slider {
height: 290px;
width: 470px;
}
Ramsesx
08-05-2011, 08:43 PM
That's it. Thanks for your outstanding support. :up:
MikalMirkas
08-06-2011, 05:08 AM
I see, thanks for the link. :)
First, the switch "show_articles_without_image is set to false" and you do not have articles with images (as far as i can see as a guest) so the slider does show nothing.
Another problem might be the default date range i included, this is set to 40 days. Any article older than that isn't shown. Can be changed easily though.
Secondly, you have 3 jquery files included in the source code of your page. jquery-1.6.1 / jquery.js and jquery-1.3.2min. That does cause problems and you do not need all 3. Reduce this to one (but be sure to use a version above 1.4)
So what size do I want the images to be?
Also, I ran a template search and couldn't find it.
Mooff
08-06-2011, 08:34 AM
The slider does not care what size your images are.
Your articles either need to have a preview image - or you have to set "show_articles_without_image" to true in the options, then it will show a default image you can specify for articles without image.
What image size do you want the slider to use? That's a question only you can answer.
Template search? You mean for the other jquery files? You can see what they are called if you check the page via source code (in firefox ctrl+u).
You have this one:
<script type="text/javascript" src="/forum/arrowchat/includes/js/jquery.js"></script>
and that one:
<script type="text/javascript" src="steamprofile/jquery-1.3.2.min.js"></script>
and of course the slider one:
<script type="text/javascript" src="clientscript/jquery/jquery-1.6.1.min.js"></script>
As for guessing, the other ones come from a chat addon and a steam addon.
MikalMirkas
08-06-2011, 08:37 AM
The slider does not care what size your images are.
Your articles either need to have a preview image - or you have to set "show_articles_without_image" to true in the options, then it will show a default image you can specify for articles without image.
What image size do you want the slider to use? That's a question only you can answer.
Template search? You mean for the other jquery files? You can see what they are called if you check the page via source code (in firefox ctrl+u).
You have this one:
<script type="text/javascript" src="/forum/arrowchat/includes/js/jquery.js"></script>
and that one:
<script type="text/javascript" src="steamprofile/jquery-1.3.2.min.js"></script>
and of course the slider one:
<script type="text/javascript" src="clientscript/jquery/jquery-1.6.1.min.js"></script>
As for guessing, the other ones come from a chat addon and a steam addon.
So, is it a giant ordeal if I have all those jqueries there, or can I just use a higher jquery and remove all the other ones?
Mooff
08-06-2011, 08:44 AM
Use a higher jquery and remove the other ones. Jquery is known to have conflicts if more than one file is included.
But, you need to load your jquery file above all your addons which need the jquery code.
MikalMirkas
08-06-2011, 08:47 AM
Use a higher jquery and remove the other ones. Jquery is known to have conflicts if more than one file is included.
But, you need to load your jquery file above all your addons which need the jquery code.
I got the Slider to work. Just need to make it resize with the box. If you resize the page, it'll clip into the red box...
hm.
derp.
starman?
08-06-2011, 09:32 AM
Hey Mooff,
This is driving me crazy man. I've done just about everything I can think of and everything suggested here to get this working but after running in debug I get this;
DEBUG MODE is ON!
slider_img_filepath: /nivoslider/
width: 480 height: 320
show_articles_without_image: bool(true)
fallback_img: /nivoslider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home2/hzscenec/public_html
Error occurred: picture is not readable./nivoslider/uf_fallback_slider.png
Error occurred: picture is not readable./nivoslider/uf_fallback_slider.png
Error occurred: picture is not readable./nivoslider/uf_fallback_slider.png
#articles - featured and databasepull int(4) int(4)
Clearly this has to do with the images not being readable, but how do I change it so that they are? Any ideas man?
Cheers
starman?
08-06-2011, 09:47 AM
Finally worked it out. Yeahhhhhhhhhhhhhh! CMS Permissions need to be changed to make the content downloadable to the public. Please add this info to your instructions. Thanks for a great product. Cheers.
Mooff
08-06-2011, 09:59 AM
@MikalMirkas
The Nivo Slider doesn't support resizing on the fly.
You can change the width and height or the slider in general though and add a minimum width to your slider php widget.
@starman
Great to hear. :)
The information is allready in the faq ((cms)attachments need to be readable for guests). I changed the first post and included a link to the faq based on your feedback though.
starman?
08-06-2011, 10:06 AM
Must have missed that one. Thanks again.
MikalMirkas
08-06-2011, 10:07 AM
@MikalMirkas
The Nivo Slider doesn't support resizing on the fly.
You can change the width and height or the slider in general though and add a minimum width to your slider php widget.
@starman
Great to hear. :)
The information is allready in the faq ((cms)attachments need to be readable for guests). I changed the first post and included a link to the faq based on your feedback though.
O.o
Then how come UF's resizes on the fly? D:
starman?
08-06-2011, 10:14 AM
Just spotted an anomaly. After about 5 mins the text disappears leaving just a black bar. My cache is set to 120 mins for this widget. Any idea why?
Mooff
08-06-2011, 10:16 AM
We don't? Our slider is fixed to width 650px height 250px and our cms width is fixed to 1000px.
@starman
Sorry, no idea. That is a question for the nivo slider developers: http://nivo.dev7studios.com/
starman?
08-06-2011, 10:21 AM
Okay no worries man. I guess it's not a problem as you wouldn't watch it for more than a minute anyway I guess.
Mooff
08-06-2011, 10:23 AM
I won't show up every time though. I had the slider once running > 20minutes in another browser i forgot to close - and the caption did not disappear.
But yes, you are right. Probably can be considored a minor bug.
djilou
08-06-2011, 01:53 PM
Hi,
Thanks for this awesome mod, I have 2 questions :
1- I want to dispaly the Slider only on the home page, not when I browse articles, like here : http://www.united-forum.de/news/
How to do this?
2- I use vbseo on my website, I want urls to be like this : http://www.united-forum.de/news/command-amp-conquer-s5/cnc-4-clanwars-cc-229.html
instead of
http://www.united-forum.de/content.php?r=229-command-amp-conquer-s5-cnc-4-clanwars-cc-229.html
Mooff
08-06-2011, 02:46 PM
1- depends. Works via different layouts on different sections.
two options
a) you do not show articles on your homepage, only widgets. Then adding a subsection which shows the slider and telling vb in the acp to show that subsection instead of the main section will be enough.
b) you do show articles on your homepage, then create a hidding second section below your newssection with a different layout without slider. Move all categories* and articles to that second section. Set the homepage to 'show all articles from subsections.
2- activate cms rewrite in the vbseo command panel. There look for extended options (or similar, haven't checked how it is called exactly) and follow the instructions for custom rewrites.
*be careful here, moving categories via the acp is the buggiest piece of *** i have ever experienced in the vb_acp. If you can, i would strongly advise you to do it manually in the database. And backup your database before that!
MikalMirkas
08-07-2011, 03:58 AM
We don't? Our slider is fixed to width 650px height 250px and our cms width is fixed to 1000px.
@starman
Sorry, no idea. That is a question for the nivo slider developers: http://nivo.dev7studios.com/
How does one manage to do this? I've tried it before but screwed up my CMS.
doc_width?
Edit: k set doc_width to 1000 but now it's aligned to the left side of the page.
Mooff
08-07-2011, 11:43 AM
set doc_margin to 'auto' as said in the doc_margin stylevar description.
nader
08-08-2011, 03:27 AM
Beautiful work; I was waiting for long time unfortunately It is very slow!
Aramist
08-10-2011, 09:41 AM
Hi mooff !
I need your help.
In your script, when someone reply an article, the slide goes to the front of the slider cycle.
In my board I don't wanna show again older slides.
How can I change this ?
Ty in advance
Aramist
08-10-2011, 09:45 AM
hmmm nvm....
I've removed + (10 * $article['replycount'])
and now it does not count replies to make a slide appear...
It's how I need now...ty anyway. :D
Loversama
08-10-2011, 01:16 PM
Can you make this work with: Article Forums v4.x?
https://vborg.vbsupport.ru/showthread.php?t=237116
I don't use VB CMS and already use this slider (but I use it manually) for it to work with Article Forums would be amazing and would solve all my problems!
Thanks :D
Wordplay
08-10-2011, 08:44 PM
is it possible to have this work with forumposts rather than articles and have this load selected images to each slide?
that would make this so amazing. for my site i had to change the size to 830x320 for it to show up decently, i can't get it to load the article images right now, but even if i could most are 240x240 and wouldn't look right in 830x320.
Mooff
08-10-2011, 09:11 PM
@Aramist
If you do not want the value sorting function you can remove the whole sorting part and therefore gain a bit in performance (not that much, but well a bunch of calculations are unnecessary then).
(untested!)
search for:
/* 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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_DESC, $database_articles);
//
$i = 0;
$section_array = array();
$featured_articles = array();
foreach($database_articles AS $article)
{
replace with
$i = 0;
$section_array = array();
$featured_articles = array();
while($article = vB::$db->fetch_array($article_get))
{
@ Loversama
I do not know what that mod does in terms of database changes and i do not have it installed and i cannot install it on our board, nor can i install it in our testboard (there we have 3 different unreleased projects right now which i can't risk to compromise).
@ Wordplay
Working with forumposts would need a database query rewrite.
That beeing said. What can be done is showing title and description of threads and then using images based on the forum they are in. What can't be done is searching through the pagetext to find an image suited for the slider.
(Well it can, but i can't debug that and it does need a lot of thinking and work. Work which will have no use on our board. Sorry.)
As for article images not beeing suited for the slider. We do face the same problem on our board. Therefore we are using a highly customized version which does account for our needs. Like using section and category based images as fallbacks and resizeing images only for images which are at least 400px wide and have a width/height ratio between 2.5 and 2.8.
Options i can not set as default for everyone. But as said in the first post, if one does need something fancy i might be able to help with some custom code for your board. No promises though. And i need to know exactly what one does want. Exactly. Like explaining it to your grandma exactly ;)
Wordplay
08-10-2011, 09:45 PM
well this is the best slide i've ever seen:
http://www.bet.com/shows.html
i would like to impliment that into my site. is there really no way to make it just pick the first image attached to a thread?
if there is no way to make it collect information from a specific forumthread, and that slide with thumbnails would work on articles, i'll just change my forum setup around to use articles rather than forumposts to post news.
does the slider randomly pick an image from an article or does it pick out the first attachment in an article?
right now i can't get it to display any images from the articles. it just shows my default fall back image on every news article.
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...
DEBUG MODE is ON!
slider_img_filepath: uf_nivo_slider/
width: 650 height: 250
show_articles_without_image:
fallback_img: uf_nivo_slider/old-tunnel.jpg
#img: 5
description_length: 95
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...
DEBUG MODE is ON!
slider_img_filepath: uf_nivo_slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: uf_nivo_slider/uf_fallback_slider.png
#img: 5
description_length: 95
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
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
//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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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
Mooff
08-11-2011, 11:20 AM
I received a question via private message about slider timings. Since that might interest other site owners aswell.
How do I slow down the image timings, at the moment its a bit fast?
Answer:
That is a setting for the nivo slider: http://nivo.dev7studios.com/#usage
There you can see what you can change. I'll give an example for the timings.
Search:
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
Replace with:
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider({
pauseTime: 6000
});
});
</script>
This changes the pause Time between slides from 3 seconds to 6 seconds.
@croft
please go through the faq and post the debug you get (last question) if the other questions do not help.
It does look like a combination of a jquery (either to many jquery files or old jquery version or no jquery at all) issue and some problems with saving the resized image to file. Debug will help with the last one. If you can't find the jquery problem a link to the site where the slider is implemented would help.
Cheers
CharlieDelta
08-11-2011, 11:47 PM
Hi Mooff. I have this installed and looks good. I have one problem the link to the article when clicked takes me to my index page. When you hover over the link it shows the proper URL however.
CharlieDelta
08-12-2011, 03:24 PM
Hi Mooff. I have this installed and looks good. I have one problem the link to the article when clicked takes me to my index page. When you hover over the link it shows the proper URL however.
I ran a debug and there were no errors.
Any ideas?
Mooff
08-12-2011, 03:52 PM
Hi,
i need a live demo of that redirect bug. Doublecheck if the hover urls really are correct. If they are i can't think of a reason why it shouldn't work.
CharlieDelta
08-12-2011, 04:47 PM
Hi,
i need a live demo of that redirect bug. Doublecheck if the hover urls really are correct. If they are i can't think of a reason why it shouldn't work.
www.canadianriflesregiment.com. Bottom of content.php page.
I just checked the hover URL's and they are correct.
Thanks
Mooff
08-12-2011, 05:01 PM
Links in the slider are:
http://www.canadianriflesregiment.com/content.php?r=160-Welcome...
correct would be:
http://www.canadianriflesregiment.com/crrforums/content.php?160-Welcome...
You are missing the crrforums part, thus the link leads to nowhere and gets redirected.
search this part:
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
replace with:
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/crrforums/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/crrforums/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
That should work. Cheers.
CharlieDelta
08-12-2011, 06:51 PM
Mooff you are number ONE in my books!:up:
Thank you.
5 stars and nominated!
bandare
08-13-2011, 01:28 PM
I managed to get the slider to show and an image in it, but it doesn't add text and it doesn't move from article to article.
Mooff
08-13-2011, 02:32 PM
Sounds like a jquery problem. Can you link me to your (test)site where the slider is installed?
bandare
08-14-2011, 11:49 AM
Thanks very much for the help Mr Mooff. This addition is a must and exactly what I've been waiting for. I can't believe it's taken so long for someone to do and I'm really grateful for all your efforts and help.
Thanks!
Mooff
08-14-2011, 12:04 PM
Since the question came up some times allready:
Q: I want the slider without widget title - how to do that?
Answer:
create a new template (main style or all styles you have your slider running)
Name: vbcms_php_no_title
code:
<div class="cms_widget">
<div class="block">
<div class="cms_widget_content widget_content">
{vb:raw output}
</div>
</div>
</div>
save it.
go to widget configuration of the slider widget, change template name to
vbcms_php_no_title
save. Reload slider. Title is gone.
otectom
08-14-2011, 03:20 PM
Ok, so first off, THANK YOU!!!
I have been waiting for a long time for this mod, and this one does EXACTLY what I wanted!! It installed easily and works perfectly! Please view installation on my site at http://www.teamotec.net
I have 3 ??????
1. Earlier you showed how to change the image speed, but didn't specify what file to edit. Can you please clarify this for me, I want to slow mine to a 5 second pause.
2. How can you limit the sections that the slider displays? I only want to display articles from the sections "Event Coverage" "Featured Rides" & "Photography"
3. The dots that show that you are on slide 1 of 5 display in the middle of my image instead of at the top or bottom. How can I move them up or down? (I don't particularly care where they end up)
Thanks again for this great mod!! 5 Stars, Nominated, and Marked as Installed!!!
Mooff
08-14-2011, 04:23 PM
1. Not a file. That's in the php widget code, close to the bottom.
2. I'll post code for both sections and categories, since i'll link that post in the FAQ.
How to show only articles out of specific sections or categories:
for sections
find:
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');
replace with
WHERE
node.setpublish = 1 AND
node.publishdate > '. vb::$db->sql_prepare($time) .' -34560000 AND
node.publishdate < '. vb::$db->sql_prepare($time) .' AND
node.parentnode IN ( 4, 5 )
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20');
For categories
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');
replace with
WHERE
node.setpublish = 1 AND
node.publishdate > '. vb::$db->sql_prepare($time) .' -34560000 AND
node.publishdate < '. vb::$db->sql_prepare($time) .' AND
category.categoryid IN ( 31, 1 )
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20');
Can be combined of course, if you want that.
Be careful not to miss the AND part
In the Brackets the sections-Ids/ categories-Ids you want have to be included.
In your case it would be ( 144, 145, 149 )
In general you can see the fitting ids in the links which lead to the section or category:
For example:
/content/category/31-esport.html
Category esports on our site has the ID 31.
---- category/section part ends here - in case you followed the faq link ----
3. In the nivo-slider_uf_theme.css file
find:
.theme-uf .nivo-controlNav a {
background: url("nivo_slider_sprite.png") no-repeat scroll 0 -30px transparent;
border: 0 none;
display: block;
float: left;
height: 22px;
margin-right: 3px;
text-indent: -9999px;
width: 22px;
}
replace with
.theme-uf .nivo-controlNav a {
background: url("nivo_slider_sprite.png") no-repeat scroll 0 -30px transparent;
border: 0 none;
display: block;
float: left;
height: 22px;
margin-right: 3px;
text-indent: -9999px;
width: 22px;
top: -120px;
}
The top value is new. Modify that to whereever you want it.
otectom
08-14-2011, 05:05 PM
Mooff, thank you again. I have wanted this on my site for ages and on one rainy sunday morning I was able to add it and have it completely working and customized to my wants in a matter of hours. Support like this is what makes VB great.
FYI in the css file my code looked like this
.theme-uf .nivo-controlNav a {
display:block;
width:22px;
height:22px;
background:url(nivo_slider_sprite.png) no-repeat;
background-position:0 -30px;
text-indent:-9999px;
border:0;
margin-right:3px;
float:left;
}
Which is different from the code you showed above. So I simply changed it to this
.theme-uf .nivo-controlNav a {
display:block;
width:22px;
height:22px;
background:url(nivo_slider_sprite.png) no-repeat;
background-position:0 -30px;
text-indent:-9999px;
border:0;
margin-right:3px;
float:left;
top: -120px;
}
Not a real issue, but I wanted to point it out for others that may be looking to make this same change, and aren't sure about where to make it.
GamersChallenge
08-14-2011, 08:21 PM
help, the only image showing is the UF fallback image,
and yes the slider folder is read and writable.
the website is www.gamerschallenge.net
if someone could please help. really need this slider so bad.
thanx
edit: I was the FAQ and I think it might be cause the guests can't view the attachments, can anyone tell me how do I change the permissions for that? I cant find anywhere.
edit: changed the permissions settings for guest to view attachments, didnt fix the problem.
bandare
08-14-2011, 08:39 PM
Are you sure you have given read and write permissions to the folder as it says in the instructions?
GamersChallenge
08-14-2011, 08:44 PM
Are you sure you have given read and write permissions to the folder as it says in the instructions?
very sure.
Mooff
08-14-2011, 09:36 PM
I think the slider_img_filepath is wrong.
Can't confirm without the debug messages, but as a guess, change it to:
$slider_img_filepath = 'slider/';
GamersChallenge
08-14-2011, 10:00 PM
thats what it is right now, it can't be wrong since the UF does show.
and thanx for the fast reply
Mooff
08-14-2011, 10:10 PM
I see. Please post the debug - last FAQ question.
GamersChallenge
08-14-2011, 10:14 PM
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 7
description_length: 95
directory /home/gamersch/public_html
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Warning: getimagesize(http://gamerschallenge.net/attachment.php?attachmentid=39&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Error occurred: picture is not readable.slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Warning: getimagesize(http://gamerschallenge.net/attachment.php?attachmentid=40&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Error occurred: picture is not readable.slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Warning: getimagesize(http://gamerschallenge.net/attachment.php?attachmentid=38&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Error occurred: picture is not readable.slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Warning: getimagesize(http://gamerschallenge.net/attachment.php?attachmentid=37&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Error occurred: picture is not readable.slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Warning: getimagesize(http://gamerschallenge.net/attachment.php?attachmentid=36&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 128
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(5) int(5)
Mooff
08-14-2011, 10:40 PM
that is the error:
URL file-access is disabled in the server configuration
The slider gets all pictures via http - attachments and external images. In your server configuration that is disabled. So the slider can't load and resize those picture to the size it does need.
Best is to ask the techadmin of your server what setting does cause this, why it is off and if it can be activated.
If it can't be activated an option would be not to resize the pictures at all - BUT then the slider will look odd if the pictures do not have the required width and height the slider needs.
GamersChallenge
08-14-2011, 11:08 PM
alright, I opened a support ticket to my host provider since I couldnt find such an option in my cpanel.
URL file-access is now enable and slider works fine.
thanx for the support.
nominated this mod for MOTM.
theoutlawed
08-15-2011, 04:45 AM
works fine on 4.1.5 pl1
thanks for the killer slider mod.
msalazar
08-15-2011, 11:41 AM
It didint wwork for me something must be wrong with my installation
andycaps
08-15-2011, 01:36 PM
My admin members have asked me to remove the slider because of the 1) size of the frame and 2) how the frame stretches the images.
A lot of my contributes are writers and have trouble re-sizing images to match the slider frame, thus a lot of their images look very poor when in reality they are just not the same size as the frame. Is there any way to display the images as they should be, appreciate some of the images may be small but at least they will not be stretched. BETTER still - is there are way of automatically resizing the image to say a maximum hight of say 300 pixels?
thanks
Scalemotorcars
08-15-2011, 02:12 PM
Well Ive read the entire thread and tried all the fixed. I just got off the phone with my host and they will NOT be turning (URL file-access) back on and they suggested using an alternative.
They of course didn't offer any further help then that so I hope someone here can help me get this sorted out.
With debug on I get the errors at the bottom of this post only once they they vanish after visiting another url. If I clear the cache they come right back or if I refresh the page they stay at the top. The slider seems to be working fine except for the fact that it doesnt pull any attachments and I do not see any images saved in my slider folder.
Attachments for guests are on both in usergroups and CMS
Folder is 777
Path is correct
I changes the size but also changed it in the CSS
DEBUG MODE is ON!
slider_img_filepath: clientscript/slider/
width: 975 height: 250
show_articles_without_image: bool(false)
fallback_img: clientscript/slider/uf_fallback_slider.png
#img: 20
description_length: 95
directory /home/p16t2ugb/public_html/forum
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Warning: getimagesize(http://www.scalemotorcars.com/forum/attachment.php?attachmentid=16072&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Error occurred: picture is not readable.clientscript/slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Warning: getimagesize(http://www.scalemotorcars.com/forum/attachment.php?attachmentid=15949&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Error occurred: picture is not readable.clientscript/slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Warning: getimagesize(http://www.scalemotorcars.com/forum/attachment.php?attachmentid=15946&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Error occurred: picture is not readable.clientscript/slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Warning: getimagesize(http://www.scalemotorcars.com/forum/attachment.php?attachmentid=15902&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Error occurred: picture is not readable.clientscript/slider/uf_fallback_slider.png
Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Warning: getimagesize(http://www.scalemotorcars.com/forum/attachment.php?attachmentid=15896&cid=24) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 129
Error occurred: picture is not readable.clientscript/slider/uf_fallback_slider.png
#articles - featured and databasepull int(5) int(7)
Mooff
08-15-2011, 02:14 PM
@ andycaps
First post section "Custom Settings"
Make changes here
//picture width and height !same as in the CSS FILE!
$maxwidth = 650;
$maxheight = 250;
and here
.theme-uf #slider {
margin:0px auto 0 auto;
width:650px; /* Make sure your images are the same size */
height:250px; /* Make sure your images are the same size */
}
You can change those numbers any way you like to match your site needs.
Different sizes for each image is not supported by the nivo slider - well it can be done, but does look horrible.
Of course additional rules for the resizing process can also be added. Let's say pictures is smaller than 200px -> it won't be used and the slider takes the fallback image instead (that's basecially how we do it on our site). As said in the first post, if one wants something special, just ask - i will try to come up with some code, but won't promise i will.
Mooff
08-15-2011, 02:42 PM
Well Ive read the entire thread and tried all the fixed. I just got off the phone with my host and they will NOT be turning (URL file-access) back on and they suggested using an alternative.
They of course didn't offer any further help then that so I hope someone here can help me get this sorted out.
Sorry to hear that. :(
An idea would be to use cURL instead especially for attachments. Meaning 'reparsing' the previewimage when it is an attachment to get the attachment id, then starting a curl request to the attachment.php file and send the id as post/get value.
With such a fix attachments should start working even with allow_url_include disabled.
But, and i'm sorry to say that, i won't code that - just wanted to add the idea if one want's to take a shot at it.
Regards
edit: another option would be disableing the image resize process. Then you should make sure that your attachments are allready uploaded in the size the slider does need.
Scalemotorcars
08-15-2011, 02:59 PM
So theres no other fix if the host refuses to turn of the URL file-access? I haven't a clue how to recode for curl.
And for the re-size. I already got that in both.
Mooff
08-15-2011, 03:04 PM
edited the same time you made your post.
edit: another option would be disableing the image resize process. Then you should make sure that your attachments are allready uploaded in the size the slider does need.
That would be (untested):
replace
//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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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 />';
}
with
if($article['previewimage'] )
{
//do nothing
}
else
{
$article['previewimage'] = $fallback_img;
echo '<span style="color:red">Warning:</span> article has no previewimage or sprite is no ressource. ' . $article['previewimage']. '<br />';
}
Pictures should show up then. But it might look odd if the pictures do not have the right width and height.
Scalemotorcars
08-15-2011, 03:11 PM
I figured out a way around the hosts rule so I have it working now without the edit above.
Im sure this has been covered but spare me a few brain cells so I get BTW.. :D
Image re-sizes but stretches. Can it be set to fill the area rather then stretch?
And by the way. Huge thank you for the quick replies. Best mod support Ive ever seen.
:up:
I guess I should add the work around.
Just added a php.ini to the root with this function enabled.
theoutlawed
08-15-2011, 05:36 PM
Having 1 small issue. The highlight "dots" for lack of better word that are supposed to be in the top right corner are about 1/3 from the top down and on the right of my slide. Not sure how or why the only changes I've made in the CSS is to height/width and then the # of slides.
http://www.outlawedoffroad.com/content/ is the live example of whats happening.
Any help is appreciated. Love this mod, not I just have to start using pics that will fit it better which for future posts won't be a problem we'll just format/standardize the first pics and it'll be golden. Thanks again.
Scalemotorcars
08-15-2011, 10:54 PM
Having 1 small issue. The highlight "dots" for lack of better word that are supposed to be in the top right corner are about 1/3 from the top down and on the right of my slide. Not sure how or why the only changes I've made in the CSS is to height/width and then the # of slides.
http://www.outlawedoffroad.com/content/ is the live example of whats happening.
Any help is appreciated. Love this mod, not I just have to start using pics that will fit it better which for future posts won't be a problem we'll just format/standardize the first pics and it'll be golden. Thanks again.
Look at the CSS, you should see the positioning of the buttons. Since you made it taller you need to move the buttons up. I haven't looked but you should see something with a minus and a number, just add to that number. :up:
Mooff
08-16-2011, 11:25 AM
@theoutlawed
Check this post:
https://vborg.vbsupport.ru/showthread.php?p=2233439#post2233439
(your top value might differ, just try different values till it is in the right place)
@Scalemotorcars
Strechting is on purpose cause fill or cropping the images would look even worse. Best course of action is to use previewpictures for the articles which are near the slider width/height ratio.
Scalemotorcars
08-16-2011, 12:06 PM
Thanks :D
I simply made it taller and its looking pretty sharp now. Thanks again for all the help and great mod. :up:
theoutlawed
08-16-2011, 02:59 PM
Look at the CSS, you should see the positioning of the buttons. Since you made it taller you need to move the buttons up. I haven't looked but you should see something with a minus and a number, just add to that number. :up:
Yup my bad.. Should have looked in the CSS file first.. Saw it in 2 seconds..
Thanks for the assist, 5 second change and BOOM it's perfect again. This mod is one of the best things I've done to my homepage/cms it gives such a clean and professional look to a casual visitor who may see a dozen similar forums.
theoutlawed
08-16-2011, 03:00 PM
@theoutlawed
Check this post:
https://vborg.vbsupport.ru/showthread.php?p=2233439#post2233439
(your top value might differ, just try different values till it is in the right place)
@Scalemotorcars
Strechting is on purpose cause fill or cropping the images would look even worse. Best course of action is to use previewpictures for the articles which are near the slider width/height ratio.
Thanks Mooff, A+++ loving how the frontpage is starting to look.
WoODoO
08-17-2011, 12:21 PM
This error occurred
DEBUG MODE is ON!
slider_img_filepath: /externo/slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: /externo/slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/coalizao/public_html
Error occurred: picture is not readable./externo/slider/uf_fallback_slider.png
Error occurred: picture is not readable./externo/slider/uf_fallback_slider.png
#articles - featured and databasepull int(3) int(3)
Directory perms 777.
allow_url_fopen active.
But slider not appear.
Mooff
08-17-2011, 04:34 PM
That is not the full error message is it?
LOGECT
08-17-2011, 05:06 PM
Great job Mooff.
WoODoO
08-17-2011, 05:18 PM
That is not the full error message is it?
Yes, that's the message from the Debug mode ON.
No more error messages occur, only these.
He had little news, I remove them.
And now I'm adding fake news for tests.
Create the news, get a picture and the text.
I will re-creates the widget Slider
Let's see if it will work, post again after testing
WoODoO
08-17-2011, 05:27 PM
New test, same error messages :(
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/coalizao/public_html
#articles - featured and databasepull int(2) int(2)
What might be happening?
Mooff
08-17-2011, 05:33 PM
Can you link me to your site please?
(if you do not want your site link to be known to the public send me a link via private message)
Scalemotorcars
08-18-2011, 12:18 PM
This is kind of random so Im not really sure whats going on.
For some reason when I promote a forum post to an article it messes up the syncing of the slider.
The slides don't match the text. I think its a cache issue. Can someone please give me some cache time examples. I don't mind it lagging a few minutes but if it gets stuck for days that's not going to work...
Mooff
08-18-2011, 03:30 PM
It's a browser cache issue. We had that in the sprite addon aswell. For some strange reason the modern internet browsers don't get when the filename stays the same but the contents of a file have changed. Meaning it will show you an old slide1.jpg out of your browser cache which doesn't match the slide1.jpg on the server. Hit force refresh (ctrl+r or ctrl+f5 on firefox) and it should be solved - sidenote, neither opera nor chrome have a force refresh anymore afaik, there the cache has to be cleared manually.
Osbes did fix it in version 0.8.0 of the sprite addon (which is currently in alpha stage) by using different file names each time he creates a sprite. As soon as he releases 0.8.0 i'll snatch that code snippet and update the slider. :D
Scalemotorcars
08-18-2011, 11:30 PM
Thanks man.
Whats a good time for the cache until then?
doctorsexy
08-22-2011, 07:01 PM
Hi is there a problem with this and chrome .as all the images only in chrome are broken up in to squares...
Konsolenheld
08-22-2011, 07:25 PM
Does it work on 4.0.6?
Mooff
08-22-2011, 08:13 PM
@doctorsexy
nivo slider on their homepage:
Browser Support
Nivo Slider has been tested in the following browsers:
Internet Explorer v7+
Firefox v3+
Google Chrome v4+
Safari v4+
Opera v10+
So i assume there should be no problem with Chrome.
@Konsolenheld
I do not have a 4.0.6 board at hand, but it should work just fine.
As a sidenote. Since it does use the nivo slider. Every setting which is possible in the nivo slider can be used here. Including thumbnail images.
doctorsexy
08-23-2011, 08:13 AM
This is what it looks like in chrome... it sticks like it untill the other picture starts..
Mooff
08-23-2011, 08:29 AM
Ok, i just installed chrome (13.0.782.215 m) and tested the following sites:
www.united-battlezone.de (our slider)
http://nivo.dev7studios.com/ (nivo slider main)
http://nivo.dev7studios.com/demos/ (demo 1)
http://nivo.dev7studios.com/demos/2/ (demo 2)
http://nivo.dev7studios.com/demos/3/ (demo 3)
everything looks fine there.
I also checked the link in your signature with said chrome version and it does not show that error.
Loversama
08-23-2011, 01:22 PM
@ Loversama
I do not know what that mod does in terms of database changes and i do not have it installed and i cannot install it on our board, nor can i install it in our testboard (there we have 3 different unreleased projects right now which i can't risk to compromise).
Ahh, well if you do have any plans in the future to allow this amazing mod to work with it that would be great!
www.SinfulShadows.com is my website, I have the VB4 forums but didn't want the CMS, its lame that I cannot make the rest of my site dynamic without it lol :P
Ill be watching this thread eagerly! :)
Hello, First of all thank you for this I have installed and using, Second, Why does the image quality seem to change? can anyone tell me why and how to stop this.
If I upload a 100kb image that looks fine in the article then look so washed out and is only say 30kb slide?
Cheers
doctorsexy
08-23-2011, 07:26 PM
Just found the problem ... changed the size to this $maxwidth = 600;
$maxheight = 260; and its fixed...thanks
Mooff
08-23-2011, 09:07 PM
@doctorsexy
great =)
@Hiks
default quality settings for jpegs is 75 in GD.
search for
$success = imagejpeg($sprite, DIR . ($img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath);
replace with
$success = imagejpeg($sprite, DIR . ($img_filepath[0] != DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : '') . $img_filepath , 90);
If it still doesn't look good change 90->100, but your files might get big then.
@ Mooff
You are a Star, cheers for that top support.
doctorsexy
08-25-2011, 01:39 PM
Had to remove it ...was causing an internal 500 error and slowing the server to a crawl...shame
Has anyone got it running on 4.1.5
Mooff
08-25-2011, 02:15 PM
We have it running just fine on our 4.1.5 test board.
As for server load. As said in the installation instructions, i would strongly recommend to use the cms cache on that widget. It does resize and save a number of pictures when it does run, a process which can't be fast. But it doesn't have to do that often. Articles in the Slider most likely won't change for hours, on some sites even days - so a cache time of 60minutes or more shouldn't be an issue. Even 30minutes shouldn't stress your server at all.
Once it is beeing loaded out of the cache it is blazing fast and won't stress your server at all.
Scalemotorcars
08-25-2011, 02:35 PM
Ive been having cache issues with Chrome and Firefox as well.
If Im logged it its fine but if Im not them I get the default image. Permission's are correct for attachments.
The Rocketeer
08-27-2011, 05:29 AM
Hey Mooff, Have been using this for weeks now, No complaints so far but just one... I have the cache set for a log time (90000). But it seems to me that it has slown down my vbulletin a lot with the load times. The server also seems to have slowed down a bit.
Is there anyway we could improve that, and also wanted to know is there any way you could code the mod so that its loaded after the homepage is loaded. I mean that way the users wont have to wait for the whole webpage to load up. Like let the rest of the website load first and this at the very end, if you know what I am trying to say?
Thanks Mooff
:)
Scalemotorcars
08-27-2011, 08:43 PM
Still cant find the issue with guests and getting the default image. Everything seems to be set right and it works sometimes. If I log in then its fine.
All I can figure is that its the cache time. Ive tried everything from 5 minutes to 1440 minutes and no change. Anyone have an ideal whats up with this?
The Rocketeer
08-28-2011, 03:26 AM
Still cant find the issue with guests and getting the default image. Everything seems to be set right and it works sometimes. If I log in then its fine.
All I can figure is that its the cache time. Ive tried everything from 5 minutes to 1440 minutes and no change. Anyone have an ideal whats up with this?
Could be a permission issue. I had a similar issue like you actually, dont remember how I fixed it, look back a few posts.
Mooff
08-29-2011, 05:41 PM
Ok guys, sorry about the lack of support lately. We have been extremlay busy releasing the vBExperience https://vborg.vbsupport.ru/showthread.php?t=245023&page=134 on our board. And well, when we install a new addon like this we do it the right way - well or the crazy way. :D
We wrote 7 plugins, changed templates and added over 150 achievements for that thing in order to customize it for our board.
That aside two new huge projects came up, which left me with no time for the slider.
So i'll post a quick fix for the browser cache issue, instead of releasing a new version.
To avoid the issue i'm going to give each saved image a unique name. But! I do not have time to bugcheck a delete function for old images which aren't used anymore - so i won't include that.
If you use that fix i would advise to delete all images in the slider folder from time to time.
Well here goes the code:
Find
imagecopyresampled($sprite, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
replace with
imagecopyresampled($sprite, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $article['nodeid'] . '.jpg';
Regards Mooff
clutchthese
08-29-2011, 09:55 PM
I'm getting this error.
Parse error: syntax error, unexpected '/' in /home/stealthy/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 1
stealthygaming.com
Mooff
08-29-2011, 10:10 PM
I guess the first line in your widget php code looks like that
/Debug
instead of
//Debug
please make sure you copied the whole code.
clutchthese
08-29-2011, 10:43 PM
ha, and so you're correct! :) Thanks a bunch!
You're the bestest!
clutchthese
08-29-2011, 11:20 PM
It looks amazing on your site, but i personally think it looks like dodo with the widget surrounding it. How do you get it to be just on the site without the surrounding widget?
The Rocketeer
08-30-2011, 09:00 AM
It looks amazing on your site, but i personally think it looks like dodo with the widget surrounding it. How do you get it to be just on the site without the surrounding widget?
Easy, Click Edit on the CMS > Widgets> Slider Widget. See the Template Name below? Copy it and then search for it in Template Search, Then Copy the contents of that Template, Create a new Template with similar name title and then add like _slider at the end), Copy everything to it and then edit out the parts you need. IMO, Just keep the ".raww" and delete all the other <div>'s surrounding it. Done! :up:
@ Mooff - my questions when you get time please :o
:up:
Mooff
08-30-2011, 10:22 AM
Hey Mooff, Have been using this for weeks now, No complaints so far but just one... I have the cache set for a log time (90000). But it seems to me that it has slown down my vbulletin a lot with the load times. The server also seems to have slowed down a bit.
Is there anyway we could improve that, and also wanted to know is there any way you could code the mod so that its loaded after the homepage is loaded. I mean that way the users wont have to wait for the whole webpage to load up. Like let the rest of the website load first and this at the very end, if you know what I am trying to say?
Thanks Mooff
:)
Sorry, must have missed your post.
It will have a small effect on load times since it does add additional http requests and data which has to be transfered for the pictures, the javascript in the css files. Then it has to build the slider using javascript.
The effect should not be big though.
If you use the cache, especially "never refresh me" settings it shouldn't affect your server performance at all.
It would be great if vbulletin would be build in a way that it does send out data before it actually goes through all the php files. Unfortunately it does not. And in addition the CMS still is in beta phase. Look through JIRA (the vbulletin bug tracking tool) and you will find a lot performance improvement requests for the CMS. Right now there is a huge difference in vb-forum performance and vb-cms performance. I hope they are going to adress those issues in 4.2.
As for us coding stuff there. Might happen, Osbes has some ideas what we might be able to do there, but, right now other projects are our main priority (sprites for example) and we are talking about several months before we can start looking into it. And even then it isn't clear whether we can actually gain performance there. So best bet is to vote for those issues in JIRA and ask vbulletin to fix them.
clutchthese
08-31-2011, 12:21 AM
Easy, Click Edit on the CMS > Widgets> Slider Widget. See the Template Name below? Copy it and then search for it in Template Search, Then Copy the contents of that Template, Create a new Template with similar name title and then add like _slider at the end), Copy everything to it and then edit out the parts you need. IMO, Just keep the ".raww" and delete all the other <div>'s surrounding it. Done! :up:
@ Mooff - my questions when you get time please :o
:up:
You sir, are a genius. :)
I did it!
And i love this slider! Thank you very much!
Scalemotorcars
08-31-2011, 09:12 PM
Thank you sir. Seems that the image cache is back. Ill let you know if that gremlin pops up again... :)
zairafusco
09-02-2011, 09:05 PM
@Moof
great work, thank you so much
i wonder how can i change the code just to show the last n articles ordered by date (descending)
thank you again for your work and your support
The Rocketeer
09-03-2011, 03:51 AM
You sir, are a genius. :)
I did it!
And i love this slider! Thank you very much!
No Problem Bud.. :up:
For those of you looking to make it look much like Mooff's site (with no background box)
Try this
Create a New Template called
vbcms_widget_execphp_page_nobackground
Then replace all the code with just
{vb:raw output}
Then Save
No Go to, CMS > Widgets > Slider Then edit the template line and put
vbcms_widget_execphp_page_nobackground
And maybe set the cache to 9000 for best performance?
Should be done, :p Have a look at the attachments below:up:
Mooff
09-03-2011, 09:18 AM
@Moof
great work, thank you so much
i wonder how can i change the code just to show the last n articles ordered by date (descending)
thank you again for your work and your support
Sorry, must have forgot to add this one into the FAQ:
https://vborg.vbsupport.ru/showpost.php?p=2231992&postcount=120
No value sorting -> ordered by date descending.
@ The Rocketeer
This was kinda already in the FAQ (not title version), added your version anyway, the attachments might make it clearer. =)
zairafusco
09-03-2011, 09:33 AM
@Mooff (double 'f', sorry i misreaded before!)
i had already read that but i was uncertain if it was what i needed.. now i'm sure, so i'll put that in my code, thank you again!
The Rocketeer
09-03-2011, 12:42 PM
@ The Rocketeer
This was kinda already in the FAQ (not title version), added your version anyway, the attachments might make it clearer. =)
Thanks Mooff. :) Yea I know, the CMS is a disaster, and on top of that a lot of staff are leaving too. But I'm Hoping for 417 to fix some issues tho. No miracles lol
By the way, checkout this guy's CMS http://www.nationofblue.com/
Maybe it'll give you a good idea for your own site, and also the slider the guy is using looks really fast and a lot more professional, Not sure what its name is, (looks a lot like Front Page Content Slider, but feels a lot different) Any chance you might deem using it worth using instead?
Thanks for everything and All the best Mooff. :)
Mooff
09-03-2011, 01:53 PM
I currently do not see the need to change the slider engine. Nivo is very powerful and for me really fast in chrome, opera and firefox.
In addition it is highly customizable. It can look like that:
http://nivo.dev7studios.com/demos/4/ (thumbnails)
http://www.songoperated.com/ (background version)
But well my plugin mainly provides the bridge between vb4-articles and the slider. What the slider does look like is up to the user.
w3rk3d
09-04-2011, 02:19 AM
Nice mod! I've installed it, but I'm really hoping future updates will address how this script slows the page loading. I'm guessing it's because there's 100 KB of JS that needs to download?
apaydin2148
09-04-2011, 08:27 PM
how can I create a new php-widget? I can't find it.
zairafusco
09-06-2011, 10:52 AM
ok... maybe i missed something but i tried to have two instances of the slider
(nb. as you told me in my previuos help request i changed the part of code about the selection.. i jut need articles by date)
so 1) i create a second widget 2) edited the widget (changes also the the DIV id, the .css path and also doubled the .js file trying to have 2 indipendent things)
at this point everything was fine, i had 2 sliders on the same page, each with a different .css customization
but obviously i wanted them to be linked to 2 different CMS sections, so i added the code AND.. to the SELECT, and the correct section ids and ...
that didn't wok, it seems some kind of conflict issue (if i remove one slider the other works correctly) ..
the problem is: the second slider (say they are in the navbar, so the first on the top with section'a' set and the second right under with the section 'b') get "confused" mixing the articles of the sections a and b (precisely:it shows the only article of section 'a' and the first one of section 'b' which has 2 articles).. i think could be related to the result of the first SELECT, maybe if it possibile to have the second select starting from zero.. i event ried to rename all the variables but the result is still the same
any help?
thanks for your support
YkudzA
09-06-2011, 11:37 AM
sorry for off but I`m glad to see C&C staff there :)
sensimilla
09-06-2011, 12:29 PM
Thanks for this great addon.
I ve read several QA here and still I cant find why the slider displays only default uploaded image.
Permissions and path checked and rechecked..
The attachments are not transformed into png btw..
Any ideas ?
Mooff
09-06-2011, 01:14 PM
@YkudzA
Great to see you too. :) Big thanks for the donation.
@zairafusco
Can you link me to your site where the sliders are installed?
As a guess i would say you are using the same folder for both sliders and therefore it does overwrite the pictures. Can you confirm that the captions and descriptions are correct and the images are not?
If that is the case i have two solutions for you:
a) use different folders
b) use this (browser cache issue) fix: https://vborg.vbsupport.ru/showpost.php?p=2239532&postcount=195
@w3rk3d
I don't see a page load slowdown on our site. Since we are into page speed a lot (see the sprite addon) i'm very curious where that problem might come from. If it really is the nivo slider framework we will switch the engine. But as of right now i can't reproduce that behaviour and in addition the nivo slider is used a lot on the internet, so i would assume their support forum beeing flooded if it does affect loading times.
@sensimilla
Please check the last FAQ question and send me the debug.
@apaydin2148
you need to have the suite and cms active, then in the acp it's in the cms->widget->new_widget section
sensimilla
09-06-2011, 01:30 PM
Thanks for your fast response.. it says
DEBUG MODE is ON!
slider_img_filepath: /var/www/sites/stylwolny.pl/public/slider/
width: 500 height: 250
show_articles_without_image: bool(false)
fallback_img: /var/www/sites/stylwolny.pl/public/slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /var/www/sites/stylwolny.pl/public
Error occurred: imagejpeg failed. http://www.stylwolny.pl/slider/palikotvsholdys.png
directory: /var/www/sites/stylwolny.pl/public/var/www/sites/stylwolny.pl/public/slider/slide_0.jpg#articles - featured and databasepull int(1) int(1)
Mooff
09-06-2011, 02:55 PM
change
$slider_img_filepath: '/var/www/sites/stylwolny.pl/public/slider/';
to
$slider_img_filepath: 'slider/' ;
zairafusco
09-06-2011, 06:57 PM
@Moof
i followed your hint about different folders..it's almost ok but...
i added also (trying everything) a static slider (slider 3) and now slider 1 and slider 2 (dynamic) are linked to the right sections but instead of articles text they both get the static text of slider 3..
if i remove slider 3 i have the same problem.. the sliders show both the same text (slider 1 articles)
NB. but the link to the article is correct (clicking on the image thoug, the caption show only the slider 3 href)
link:
www.dogmylife.com/beta
thank you not only for your mod but for the great support (and fast!)
HERE THE CODE OF SLIDER 1
//////////////////////////////////////////////////////////////////////////////////////////////////////////SLIDER 1
// 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 = 'nivo1/';
//picture width and height !same as in the CSS FILE!
$maxwidth = 300;
$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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
//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: ";
var_dump($show_articles_without_image);
echo " <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) .' -34560000 AND
node.publishdate < '. vb::$db->sql_prepare($time) .' AND
node.parentnode IN ( 125)
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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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> <p style="text-align:right"><a href="content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">Leggi tutto</a></p>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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);
//Debug Messages
if($debug_modus)
{
echo '#articles - featured and databasepull ';
var_dump(count($featured_articles));
var_dump(count($database_articles));
}
$output_bits = '
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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="slider1" 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() {
$("#slider1").nivoSlider();
});
</script>
</div>
';
$output = $output_bits;
if($debug_modus === false)
{
ob_end_clean();
}
zairafusco
09-06-2011, 07:35 PM
//////////////////////////////////////////////////////////////////////////////////////////////////////////SLIDER 2
// 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 = 'nivo2/';
//picture width and height !same as in the CSS FILE!
$maxwidth = 300;
$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 = 5;
//lengh in characters of the article descriptions
$description_length = 95;
//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: ";
var_dump($show_articles_without_image);
echo " <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) .' -34560000 AND
node.publishdate < '. vb::$db->sql_prepare($time) .' AND
node.parentnode IN ( 129)
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'] = ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) * ( 5 - ($time - $article['publishdate'] ) / 86400 ) + (10 * $article['replycount']);
$database_articles[] = $article;
}
foreach($database_articles as $c => $key)
{
$sort_value[] = $key['value'];
}
array_multisort($sort_value, SORT_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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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> <p style="text-align:right"><a href="content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">Leggi tutto</a></p>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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);
//Debug Messages
if($debug_modus)
{
echo '#articles - featured and databasepull ';
var_dump(count($featured_articles));
var_dump(count($database_articles));
}
$output_bits = '
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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="slider2" 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() {
$("#slider2").nivoSlider();
});
</script>
</div>
';
$output = $output_bits;
if($debug_modus === false)
{
ob_end_clean();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////SLIDER 3
<link rel="stylesheet" href="nivo3/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="nivo3/nivo-slider_uf_theme.css" type="text/css" media="screen" />
<div style="height:250px;">
<div id="wrapper">
<div class="slider-wrapper theme-uf">
<div class="ribbon"></div>
<div id="slider3" class="nivoSlider">
<a href="http://consortium.stormspire.net"><img src="bgheader/bgheader1.jpg" alt="" title="#htmlcaption1" /></a>
<a href="http://consortium.stormspire.net"><img src="bgheader/bgheader2" alt="" title="#htmlcaption2" /></a>
</div>
<div id="htmlcaption1" class="nivo-html-caption">
<b>First slide..</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
<div id="htmlcaption2" class="nivo-html-caption">
<b>Second slide..</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
</div>
</div>
</div>
<script type="text/javascript" src="' nivo3/'jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="nivo3/jquery.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider3").nivoSlider();
});
</script>
</div>
Mooff
09-07-2011, 11:14 AM
I think this is the problem:
<div id="htmlcaption1" class="nivo-html-caption">
<b>First slide..</b> </ br> testing.. <a href="http://consortium.stormspire.net">read more</a>
You probably have multiple divs with the id htmlcaption1.
Please try this:
replace
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
with
$article_neu['htmlcaptionname'] = 'htmlcaption' . $article['nodeid'] ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#'. $article_neu['htmlcaptionname'] . '" /></a>';
in all automated sliders
zairafusco
09-07-2011, 05:24 PM
@Moff
ok!!! you're great..
btw...what do you think about my customization? (i like it .it's still in progress)
thank you again
ENZO-F
09-08-2011, 05:09 PM
change
$slider_img_filepath: '/var/www/sites/stylwolny.pl/public/slider/';
to
$slider_img_filepath: 'slider/' ;
I have installed this and configured it but I am only able to see the fallback image.
Debug:
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/forum/public_html/forums
Error occurred: picture is not readable.slider/uf_fallback_slider.png
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(2) int(4)
Mooff
09-08-2011, 06:11 PM
That's everything you get for debug? Nothing more?
Can you link me to your site?
ENZO-F
09-08-2011, 06:27 PM
That's everything you get for debug? Nothing more?
Can you link me to your site?
Yes, that is the full output.
http://www.nextgenupdate.com/forums/content/
There is still work being done to the CMS.
Kr33p3r
09-09-2011, 03:00 AM
Same as above!
Hi there!
Everything works, except it won't pull the image!
I've checked the CMS permissions and its set to allow download of attachments to everyone.
Help!
Thanks!
http://www.cyberneticpunks.com/forums/content/
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/straleyw/public_html/cp/forums
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(1) int(1)
Gamelobby
09-09-2011, 08:58 AM
Ok so im confused...
I installed & i see UF image, but where am i supposed to put images so they slide.!?
Does this pull from a forum section or thread..?
OR
Do i just add images to the slider folder on my server.? (that would actually be better for me. :))
Mooff
09-09-2011, 09:28 AM
Seems like error messages are suppressed in your php settings.
Some questions for you guys then:
- Is the slider folder writeable for your webserver?
- Do you have the php GD libary installed?
- Is allow_url_access set to false in your php settings?
@Gamelobby
The slider does pull your article preview images and automatically resizes and saves them to the slider folder.
Kr33p3r
09-09-2011, 04:14 PM
GD is installed.
GD Support enabled
GD Version bundled (2.0.34 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.2.1
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XPM Support enabled
XBM Support enabled
I made everything 777 just to test:
drwxrwxrwx 2 straleyw straleyw 4.0K Sep 7 17:39 ./
drwxr-xr-x 31 straleyw straleyw 4.0K Sep 7 17:39 ../
-rwxrwxrwx 1 straleyw straleyw 90K Sep 7 17:39 jquery-1.6.1.min.js*
-rwxrwxrwx 1 straleyw straleyw 16K Sep 7 17:39 jquery.nivo.slider.pack.js*
-rwxrwxrwx 1 straleyw straleyw 1.5K Sep 7 17:39 nivo-slider.css*
-rwxrwxrwx 1 straleyw straleyw 1.8K Sep 7 17:39 nivo-slider_uf_theme.css*
-rwxrwxrwx 1 straleyw straleyw 6.3K Sep 7 17:39 nivo_slider_sprite.png*
-rwxrwxrwx 1 straleyw straleyw 25K Sep 7 17:39 uf_fallback_slider.png*
This allow URL?
allow_url_fopen Off Off
allow_url_include Off Off
I can't tell is this is using fopen or not.
Gamelobby
09-09-2011, 05:01 PM
@Gamelobby
The slider does pull your article preview images and automatically resizes and saves them to the slider folder.
So i cant control what it shows outside of what articles are posted.?
This basically replaces articles (& makes them better), rather than adds to the front page.
I dont normally add images to the preview, but the CMS automatically pulls an image from the article.. Can i have it pull the same image.? (Not sure, but it's not doing that now)
It seems like it is going to work really well i just need to tweek it to get it working correctly. :D
Mooff
09-09-2011, 06:59 PM
@Kr33p3r
at this point the slider is using fopen:
$imageinfo = getimagesize($article['previewimage']);
@Gamelobby
I'm not sure i understand what your question is.
This addon provides a bridge between vb4 articles and the nivo slider. Therefore it is an article slider widget.
The image which the CMS automatically pulls from the article is used for the slider.
If it doesn't right now do that in your case please refer to post 227.
Kr33p3r
09-09-2011, 09:32 PM
Ok I have allowed fopen
allow_url_fopen On On
Sadly,
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/straleyw/public_html/cp/forums
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(1) int(1)
Mooff
09-09-2011, 09:57 PM
Please try switching allow_url_include to ON aswell. It's got to be one of those two.
Kr33p3r
09-09-2011, 10:36 PM
Same result, sadly.
allow_url_include On On
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/straleyw/public_html/cp/forums
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(1) int(1)
The Rocketeer
09-10-2011, 01:15 AM
Same result, sadly.
allow_url_include On On
DEBUG MODE is ON!
slider_img_filepath: slider/
width: 650 height: 250
show_articles_without_image: bool(false)
fallback_img: slider/uf_fallback_slider.png
#img: 5
description_length: 95
directory /home/straleyw/public_html/cp/forums
Error occurred: picture is not readable.slider/uf_fallback_slider.png
#articles - featured and databasepull int(1) int(1)
Hey Kr33p3r, I see you are having a problem with the fallback or source image, I had the same issue, cant remember how I solved it but might be something in the first few pages.
Anyway, I just visited your site and I wanted to ask. Can you share with us the code / edits that makes the articles appear so neatly on your CMS? Inside the green line below ?
https://vborg.vbsupport.ru/attachment.php?attachmentid=132808&stc=1&d=1315620875
I have been long waiting for such a nice flow, and I think me and a lot of others using the vbulletin CMS would certainly benefit from having it.
Edit: not trying to steal your code, just the way your articles are displayed on the home page / blog roll. You know all images nicely at the left, and the info on the right. It looks perfect!
Gamelobby
09-10-2011, 03:56 AM
@ Rocketeer..
That looks like the default CMS design..!?
You dont need a slider for that.
@Gamelobby
I'm not sure i understand what your question is.
This addon provides a bridge between vb4 articles and the nivo slider. Therefore it is an article slider widget.
The image which the CMS automatically pulls from the article is used for the slider.
If it doesn't right now do that in your case please refer to post 227.
Seems like error messages are suppressed in your php settings.
Some questions for you guys then:
- Is the slider folder writeable for your webserver?
- Do you have the php GD libary installed?
- Is allow_url_access set to false in your php settings?
@Gamelobby
The slider does pull your article preview images and automatically resizes and saves them to the slider folder.
I'm not sure, how/where do i check this..? (is it in the widget.?)
Here is what i found.. (this part is untouched from what you have above, that we are supposed to put in php widget)
//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: ";
var_dump($show_articles_without_image);
echo " <br />";
echo "fallback_img: $fallback_img <br />";
echo "#img: $number_of_articles_shown <br />";
echo "description_length: $description_length <br />";
echo 'directory ' . DIR . '<br />';
}
Here is what i get..
The UF image with my article text:
https://vborg.vbsupport.ru/attachment.php?attachmentid=132809&stc=1&d=1315630872
ALSO..
I just noticed that when i click on an image it takes me to the wrong url.. its not showing the"forum" folder in the path.?
http://www.mysite.com/content.php?r=251
Should be:
http://www.mysite.com/forum/content.php?r=251
Could that be part of the problem.?
The Rocketeer
09-10-2011, 06:41 AM
@ Rocketeer..
That looks like the default CMS design..!?
You dont need a slider for that.
Nope, That's not the default CMS design.
I was talking about the article display design he had. Its custom.
I am not asking about the slider :confused: if you had read my post carefully I said I already had the slider installed :( (one of the first installs btw) and that others who are having the same issues as I had should look back in the first few pages
Anyhow to the OP, I am just wanting to know about his article display design. Go look at the default vB article layout, its messed up compared to his. Look at the articles 1x1 in a blog roll image above, examine the area I placed in Green.
Mooff
09-10-2011, 07:26 AM
That doesn't look like a vb4-cms at all. Judgeding from the code i severly doubt it is one.
@Gamelobby
The wrong link to the articles has nothing to do with where the slider wants to save the images. Per default i'm asuming the content.php resides in the main http folder and not in a subfolder. Anyway, for that to work correctly
search in the php widget code
//Build Array
$article_neu = array();
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
and replace with this code
//Build Array
$article_neu = array();
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/Forum/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/Forum/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
As for the other question why the images do not show up. Can you please post the debug messages the slider puts out in debug mode?
As for checking how to find out whether fopen/ allow_url_open is active or not. I would have to google that aswell. Best is to ask your techadmin, since he is the guy who would need to activate it.
@Kr33p3r
I'll try to come up with a version on monday which pumps out a bit more debug to see what is going on there. Kinda lost right now.
Gamelobby
09-10-2011, 07:32 AM
Yea, I meant it looks like just a default CMS layout. (1 Column & Sidebar) He just has articles on the left, & sidebar on the right... as far as i can tell. (If it's not default we can easily make that layout, cant we.?)
That's why i said you dont need a slider for that.
I knew it wasn't the slider. lol
Gamelobby
09-10-2011, 07:35 AM
@Gamelobby
The wrong link to the articles has nothing to do with where the slider wants to save the images. Per default i'm asuming the content.php resides in the main http folder and not in a subfolder. Anyway, for that to work correctly
search in the php widget code
//Build Array
$article_neu = array();
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
and replace with this code
//Build Array
$article_neu = array();
$article_neu['description'] = '<h2 style="font-weight:bold; font-size: 14px">'. $article['title'].'</h2><span>'. $article['previewtext'] .'</span> <a href="/Forum/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a href="/Forum/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '"><img src="'.$article['previewimage'].'" alt="" title="#htmlcaption'. $i . '" /></a>';
As for the other question why the images do not show up. Can you please post the debug messages the slider puts out in debug mode?
As for checking how to find out whether fopen/ allow_url_open is active or not. I would have to google that aswell. Best is to ask your techadmin, since he is the guy who would need to activate it.
Linksd are fixed. Thanks.
How do i do Debug mode.?
&
Who is my techadmin.? (Is that my hosting.?)
Mooff
09-10-2011, 07:38 AM
Designwise it is possible, but it's not easy to force the vb4-cms to look decent. :P
Your techadmin is the guy who does all the coding on your board. Judgeding by your question you are. :P
Please set the slider to debug mode (last FAQ question) and post the output, something might show up what can help us to solve your problem.
Gamelobby
09-10-2011, 07:51 AM
Yup i guess that would be me. lol
Here is what i got.
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/Forum/slider/slide_0.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 163
Error occurred: imagejpeg failed. http://image.gamespotcdn.net/gamespot/images/2011/145/Forza4_54416_embed.jpg
directory: /home/content/08/4856008/html/gamelobby/Forum/Forum/slider/slide_0.jpg
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/Forum/slider/slide_1.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 163
Error occurred: imagejpeg failed. http://l.yimg.com/a/p/sp/tools/med/2011/08/ipt/1314751955.jpg
directory: /home/content/08/4856008/html/gamelobby/Forum/Forum/slider/slide_1.jpg
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/Forum/slider/slide_2.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 163
Error occurred: imagejpeg failed. http://l.yimg.com/a/p/sp/editorial_image/69/697c6b26c1b265fc68cc6bd8b1a1f934/chad_ochocinco_sleeps_underneath_a_whole_bunch_of_ fish.jpg
directory: /home/content/08/4856008/html/gamelobby/Forum/Forum/slider/slide_2.jpg
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/Forum/slider/slide_3.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 163
Error occurred: imagejpeg failed. http://s1.wp.com/wp-content/themes/vip/nfllabor/images/logo-shield.png
directory: /home/content/08/4856008/html/gamelobby/Forum/Forum/slider/slide_3.jpg
Warning: imagejpeg() [function.imagejpeg]: Unable to open '[path]/Forum/slider/slide_4.jpg' for writing: No such file or directory in [path]/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 163
Error occurred: imagejpeg failed. http://cache2.allpostersimages.com/p/LRG/12/1248/H51T000Z/posters/patriots-introduction-super-bowl-xxxix-tom-brady-leads-patriots-out-of-tunnel-onto-field.jpg
directory: /home/content/08/4856008/html/gamelobby/Forum/Forum/slider/slide_4.jpg
Mooff
09-10-2011, 08:02 AM
And now we know it's not fopen or url_access.
Resizing and everything works (not gonna look too good though given the width/height ratio of the pictures) but the slider can't save the pictures (cause the folder either does not exist or isn't writeable).
change:
//your slider folder - has to be read and writeable
//folder where all slider files are saved
$slider_img_filepath = 'Forum/slider/';
to
$slider_img_filepath = 'slider/'
Gamelobby
09-10-2011, 08:32 AM
And now we know it's not fopen or url_access.
Resizing and everything works (not gonna look too good though given the width/height ratio of the pictures) but the slider can't save the pictures (cause the folder either does not exist or isn't writeable).
change:
//your slider folder - has to be read and writeable
//folder where all slider files are saved
$slider_img_filepath = 'Forum/slider/';
to
$slider_img_filepath = 'slider/'
Should be readable & writable.
Removed Forum/"
*edit*
Works.!!
But my images are WAY stretched out. lol
Now i need to play with the settings, i guess. :D
Kr33p3r
09-10-2011, 05:06 PM
Designwise it is possible, but it's not easy to force the vb4-cms to look decent. :P
Truer words have never been spoken.
Sorry guys, you guys are looking at wordpress, not vBCMS. :D
The vBCMS is here:
http://www.cyberneticpunks.com/forums/content/
I still have the same issue however. It finds the fall back image fine.
Is there additional logging I can turn on?
The Rocketeer
09-11-2011, 03:18 AM
Truer words have never been spoken.
Sorry guys, you guys are looking at wordpress, not vBCMS. :D
The vBCMS is here:
http://www.cyberneticpunks.com/forums/content/
I still have the same issue however. It finds the fall back image fine.
Is there additional logging I can turn on?
Damn you!
for a min there I thought I finally got something :D
Very Nice Design BTW. Wish Anyone could make the vBulletin CMS look half decent. :(
zairafusco
09-11-2011, 07:47 PM
i know it sounds stupid but.. i wanted to have a slider without nav buttons and another one without control buttons and... i'm not able to let controls and directions buttons to show and hide editing .css files... i only managed to hide the controls but now i can't make them appear again.. and the arrows.. there's no way to make them disappear....
i'm having some kind of cache troubles of what?
btw i'm running at once 2 sliders on my page (dynamic and static version)
thank you
zairafusco
09-11-2011, 08:22 PM
sorry guys.. i must be a bit tired... read the faqs on nivo slider official website and found everything ...just playing with parameters like:
.nivoSlider({
controlNav:true,
directionNav:false});
and so on..
hope this one can be useful for someone!
thanks
Scalemotorcars
09-12-2011, 07:36 PM
Ive been messing with this for some time and I have no problem getting one slider to work on my homepage but Im trying to get another to work in a specific section.
I made a 2nd directory for the slider. So the first is slider/ the 2nd is slider2/ I have all the JS files in both as well as the fall back image.
I made a 2nd widget with and modified the code to save images in slider2/ as well as pull from a specific section.
All fine until it comes to actually seeing the slides. I get the rotation and the correct text but no images. I checked the dir. and its 777.
URL's in the slider are all correct. I click the image and I get the correct page.
Just very stuck as to why no images in the 2nd slider. Any help would be great.
Heres a copy of the widget 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 = 'clientscript/slider2/';
//picture width and height !same as in the CSS FILE!
$maxwidth = 700;
$maxheight = 375;
//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_slider2.png';
//hardcoded maximum is 20 - if you want more just ask
$number_of_articles_shown = 10;
//lengh in characters of the article descriptions
$description_length = 95;
//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: ";
var_dump($show_articles_without_image);
echo " <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) .' -34560000 AND
node.publishdate < '. vb::$db->sql_prepare($time) .' AND
node.parentnode IN ( 136 )
GROUP BY node.nodeid
ORDER BY node.publishdate
DESC LIMIT 20');
$database_articles = array();
$i = 0;
$section_array = array();
$featured_articles = array();
while($article = vB::$db->fetch_array($article_get))
{
$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, $image, 0, 0, 0, 0, $maxwidth, $maxheight, $img_width, $img_height );
imagedestroy($image);
$img_filepath = $slider_img_filepath . 'slide_' . $i . '.jpg';
$success = imagejpeg($sprite, DIR . ($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'], true, true, false, true, false);
$article['previewtext'] = strip_tags($article['pagetext'], '<a>');
$len = $description_length;
if ( strlen($article['previewtext']) > $len )
{
$article['previewtext'] = substr( $article['previewtext'] , 0 , strrpos( substr( $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 href="/content.php?r=' . $article['nodeid'] . '-' . $article['url'] . '">read on</a>';
$article_neu['htmlcaptionname'] = 'htmlcaption' . $i ;
$article_neu['picture'] = '<a 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);
//Debug Messages
if($debug_modus)
{
echo '#articles - featured and databasepull ';
var_dump(count($featured_articles));
var_dump(count($database_articles));
}
$output_bits = '
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="' .$slider_img_filepath. 'nivo-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.nivo.slider.pack.js"></script>
<script type="text/javascript">
$(window).load(function() {
$("#slider").nivoSlider();
});
</script>
</div>
';
$output = $output_bits;
if($debug_modus === false)
{
ob_end_clean();
}
zairafusco
09-13-2011, 04:45 PM
i don't know wha happened.. tried the whole thing from start several times but i'm stuck on this error (and no visible slides..).. the only difference i can get starting over is the line number
Parse error: syntax error, unexpected T_STRING in /web/htdocs/www.dogmylife.com/home/beta/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 24
i really don't know what to do..
thank you
Mooff
09-14-2011, 06:42 AM
Most likely you are missing a semicolon in line 24 of the widget php code
that would be line 24
$fallback_img = $slider_img_filepath . 'uf_fallback_slider.png';
what does yours look like?
As for the other problems. I've read them, but unfortunately no time to look into it right now. Another coding projekt on our site keeps me busy right now.
BadgerDog
09-14-2011, 11:00 AM
Installed for testing on 4.1.3 with thanks ... :)
Regards,
Doug
Edit: Un-installed .. didn't work (see pic .. just empty box with date).. thanks anyway for your efforts ...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.