vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   vB News Ticker (https://vborg.vbsupport.ru/showthread.php?t=123126)

davidw 08-07-2006 04:03 PM

ok, try this then in the plugin, find this:

PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.lastpost, t.forumid, t.open, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, t.visible, t.firstpostid, f.title AS forumtitle 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                LEFT OUTER JOIN " 
TABLE_PREFIX "post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (" implode(','$tickarray) . ") 
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

and replace with this
PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                LEFT OUTER JOIN " 
TABLE_PREFIX "post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (" implode(','$tickarray) . ") 
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

and then find this
PHP Code:

                $ticker['title']        = preg_replace('/\<[a-zA-Z0-9 \&lt;\<\,\&gt;\>\.\?\/\:\;\~\"\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/'''$ticker['title']);
                
$ticker['title']        = fetch_trimmed_title(fetch_censored_text(unhtmlspecialchars($ticker['title'])), $titlelim);
                
$ticker['date']            = vbdate($vbulletin->options['dateformat'], $ticker['dateline']);
                
$ticker['time']            = vbdate($vbulletin->options['timeformat'], $ticker['dateline']);
                
$ticker['replycount']    = vb_number_format($ticker['replycount']);
                
$ticker['views']        = vb_number_format($ticker['views']); 

and replace with this:
PHP Code:

                $ticker['title']        = preg_replace('/\<[a-zA-Z0-9 \&lt;\<\,\&gt;\>\.\?\/\:\;\~\"\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/'''$ticker['title']);
                
$ticker['title']        = fetch_trimmed_title(fetch_censored_text(unhtmlspecialchars($ticker['title'])), $titlelim);
                
$ticker_titles             .= '<a href="showthread.php?t='$ticker['threadid'] .'" title="'$ticker['title'] .'" target="blank">'$ticker['title'] .'</a> '$ticksep.''


VaaKo 08-07-2006 04:59 PM

Thank you for taking my rewuest into consideration.
However, I'm getting this error when I installed it.

Code:

Database error in vBulletin 3.5.4:

Invalid SQL:

                                SELECT t.threadid, t.title, t.lastpost, t.forumid, t.open, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, t.visible, t.firstpostid, f.title AS forumtitle
                                FROM forum f
                                INNER JOIN thread t ON t.forumid = f.forumid AND t.visible = 1 AND 10 > ( SELECT count(10) FROM thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                                LEFT OUTER JOIN post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (0,0,0,0,0,0,0,0,0)
                                ORDER BY field(f.forumid,0,0,0,0,0,0,0,0,0), t.dateline desc;

MySQL Error  : You have an error in your SQL syntax near 'SELECT count(10) FROM thread WHERE forumid = f.forumid AND visible = 1 AND datel' at line 4
Error Number : 1064
Date        : Tuesday, August 8th 2006 @ 12:07:32 AM
Script      : http://www.onelebanon.com/forum/index.php
Referrer    : http://www.onelebanon.com/forum/index.php
IP Address  : 82.198.0.27
Username    : Golani
Classname    : vb_database

:(

davidw 08-07-2006 05:24 PM

What do you have for your first forumid? it looks like 0. You need something for your forumid. Also, you may want to edit your code to remove your IP address and username.

Also, what version of SQL are using? This will only run on 4.1 or higher.

bhxtyrant 08-07-2006 07:12 PM

Hey christianb,i was wondering does this version only work with 3.5.5 or will it work ok with 3.5.4 as well?I tried installing it but i cant seem to get it working with 3.5.4 is there a version of this mod for 5.4?

davidw 08-07-2006 07:15 PM

Yes, it does work with 3.5.4 (that's what I'm running). What kind of problem are you seeing?

bhxtyrant 08-07-2006 07:17 PM

I think it may be due to me trying to use it in the header template rather then ForumHome as my ticker area is in the header,When i add the approriate mod and import the xml i set the forum id to "2" and set height width ect but nothing shows in the area at all.

Eagle Creek 08-07-2006 07:17 PM

Quote:

Originally Posted by christianb
I got mine up to 1.699seconds (in firefox) - try this - I removed a bunch of stuff that needn't be used (things I had from a query that I'm using for a hack I'm going to release later this week).

Try this one out - if this works, I'll update the hack today - which it possibly could. I disabled my vbshout and installed this and shaved 70% off my delay.

Still slow as * :(.

Quote:

Originally Posted by christianb
ok, try this then in the plugin, find this:

PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.lastpost, t.forumid, t.open, t.replycount, t.postusername, t.postuserid, t.lastposter, t.dateline, t.views, t.visible, t.firstpostid, f.title AS forumtitle 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                LEFT OUTER JOIN " 
TABLE_PREFIX "post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (" implode(','$tickarray) . ") 
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

and replace with this
PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                LEFT OUTER JOIN " 
TABLE_PREFIX "post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (" implode(','$tickarray) . ") 
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

and then find this
PHP Code:

                $ticker['title']        = preg_replace('/\<[a-zA-Z0-9 \&lt;\<\,\&gt;\>\.\?\/\:\;\~\"\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/'''$ticker['title']);
                
$ticker['title']        = fetch_trimmed_title(fetch_censored_text(unhtmlspecialchars($ticker['title'])), $titlelim);
                
$ticker['date']            = vbdate($vbulletin->options['dateformat'], $ticker['dateline']);
                
$ticker['time']            = vbdate($vbulletin->options['timeformat'], $ticker['dateline']);
                
$ticker['replycount']    = vb_number_format($ticker['replycount']);
                
$ticker['views']        = vb_number_format($ticker['views']); 

and replace with this:
PHP Code:

                $ticker['title']        = preg_replace('/\<[a-zA-Z0-9 \&lt;\<\,\&gt;\>\.\?\/\:\;\~\"\`\!\@\#\$\%\^\&\*\(\)\_\-\+\=]*\>/'''$ticker['title']);
                
$ticker['title']        = fetch_trimmed_title(fetch_censored_text(unhtmlspecialchars($ticker['title'])), $titlelim);
                
$ticker_titles             .= '<a href="showthread.php?t='$ticker['threadid'] .'" title="'$ticker['title'] .'" target="blank">'$ticker['title'] .'</a> '$ticksep.''



Do I have to try these things also?

Eagle Creek 08-07-2006 07:21 PM

EDIT:

Made the changes but not any differences..

davidw 08-07-2006 07:26 PM

@bhxtyrant - it won't work, as far as I know, in the header. It will only work in the forumhome template.

@Eagle Creek - Those are the same changes in the product I posted earlier for you. Those changes are to be made in the plugin. If you go to your Plugin System => Plugin Manager => find vB News Ticker under forumhome_complete and click on [Edit] on the right side - it will give you the option to edit the plugin.

Eagle Creek 08-07-2006 07:30 PM

I think there is something really wrong with your code.

It just take up to 20 seconds?

bhxtyrant 08-07-2006 07:40 PM

thanks christian,Is there any hope of getting this to work with the header template?I found another hack here called "Latest Threads IN Marquee" which does work in the header but it doesnt have nearly as many features as yours does such as the ability to pull news from only a single forum id.

davidw 08-07-2006 07:46 PM

@Eagle Creek, just out of curiousity, how long does it take to start the forums here: http://www.christianboards.org/forum.php

@bhyxtyrant, I can see what I can do but I'm not sure. It might possibly work but changing the plugin (in the plugin manager) from forumhome_complete to global_start and then trying the $vbnews_ticker where you want it - try that. I've not tested it, so I'm not sure if that will work or not.

Eagle Creek 08-07-2006 08:16 PM

Quote:

Originally Posted by christianb
@Eagle Creek, just out of curiousity, how long does it take to start the forums here: http://www.christianboards.org/forum.php

@bhyxtyrant, I can see what I can do but I'm not sure. It might possibly work but changing the plugin (in the plugin manager) from forumhome_complete to global_start and then trying the $vbnews_ticker where you want it - try that. I've not tested it, so I'm not sure if that will work or not.

FORUMHOME:
First time load, it kept loading and loading and after 400 (!) seconds I stopped it.
Second try: 3.156 seconds.
After a refresh of the page: 6.453

FORUMDISPLAY:
1.954 seconds

davidw 08-07-2006 08:47 PM

My average load time (for me) is about 1.7 seconds. I have done a refresh and connected as quick as 1.117. I think distance may play a part in it though.

Eagle Creek 08-07-2006 10:55 PM

I guess so.. Cause when you say my forumhome takes 6 seconds, I say you are slow :p.

But anyway: The script is slowing down my index.

Any change you will re-write the script? (I saw you already added some functions).

davidw 08-07-2006 11:13 PM

I will look at optimizing the script to make it go faster. I don't like hangups on code and will work on this moreso this week. I have 2-3 ideas I am working on. I have also thought possibly that the location (forumhome_complete) may be part of the issue there.

davidw 08-08-2006 11:24 AM

Ok, I believe I've figured out the problem :)

This works for the forumids you are not using.
(I will update the readme later today for this.)
Go to your plugin (admincp => Plugin System => Plugin Manager)
Find vB News Ticker under forumhome_complete, click [Edit]

Find (near the top)

PHP Code:

            $tickarray    =    array(
                
$vbulletin->options['fid1'],
                
$vbulletin->options['fid2'],
                
$vbulletin->options['fid3'],
                
$vbulletin->options['fid4'],
                
$vbulletin->options['fid5'],
                
$vbulletin->options['fid6'],
                
$vbulletin->options['fid7'],
                
$vbulletin->options['fid8'],
                
$vbulletin->options['fid9']
            ); 

### EXAMPLE ###
If you are only pulling news from 2 forumids, comment out fid3 - fid9 (like below) and remove the comma after the fid2 (as shown)
Remove the comma from fid2 if you are commenting out fid3

PHP Code:

            $tickarray    =    array(
                
$vbulletin->options['fid1'],
                
$vbulletin->options['fid2']       // remove the comma here
                //$vbulletin->options['fid3'],
                //$vbulletin->options['fid4'],
                //$vbulletin->options['fid5'],
                //$vbulletin->options['fid6'],
                //$vbulletin->options['fid7'],
                //$vbulletin->options['fid8'],
                //$vbulletin->options['fid9']
            
); 

Why should this work? I thought about this - this morning. There is an array of 9 variables being passed through 1 query and a subquery REGARDLESS of whether or not it is being used. Commenting out the ones not being used - it will not be passed through the query, nor will it be passed through the subquery. I did a test on my website to try it out. My forumhome load went from 1.787s to 0.897 when I commented out those above.

For now, this is a manual fix, until I can figure out how to fix this so that it doesn't have to be edited through the plugin.

Eagle Creek 08-08-2006 12:11 PM

I'm using
PHP Code:

    $tickarray    =    array(
                
$vbulletin->options['fid1']
                
//$vbulletin->options['fid2'],
                //$vbulletin->options['fid3'],
                //$vbulletin->options['fid4'],
                //$vbulletin->options['fid5'],
                //$vbulletin->options['fid6'],
                //$vbulletin->options['fid7'],
                //$vbulletin->options['fid8'],
                //$vbulletin->options['fid9']
            
); 

now because I only use one forum to pull the news out.

Whieeeeeeeeeee! It's working!
I can still see there is a delay in loading, but it isn't big (<1 seconds).

EDIT: :( no...
When I open the page, it takes about 1.5 second. After a refresh also.
When I go to a forumdisplay, and at the top I click at the hompage link it takes about 6 seconds :(.

EDIT2: Even when I'm direct opening the homepage, is slow again. Strange.

Eagle Creek 08-08-2006 02:21 PM

Ok People,

with the help from Christian (another modification) it's working fine now!
It's slowing down a little bit, but that's normal because there's more to load. You almost don't know you have the hack installed :).

Thx again David ;).

davidw 08-08-2006 04:50 PM

Quote:

Originally Posted by rmxs
now about the color i mean the letter...no boarder on option in admin control panel that user can set 2 different collors EXAPLE 1-3-5-7 topics BLUE 2-4-6-8 topics RED :)

Ok, I believe I have got this figured out :)
You need to edit the plugin to make this work.

Find:
PHP Code:

while($ticker $db->fetch_array($gettickers)) 

Add above:
PHP Code:

$color1 "#0000FF"//blue
            
$color2 "#FF0000"//red
            
$color 1

Find:
PHP Code:

$ticker_titles             .= '<a href="showthread.php?t='$ticker['threadid'] .'" title="'$ticker['title'] .'" target="blank">'$ticker['title'] .'</a> '$ticksep.''

Replace with:
PHP Code:

$tick_color                = ($color 2) ? $color1 $color2;
                
$ticker_titles             .= '<a href="showthread.php?t='$ticker['threadid'] .'" title="'$ticker['title'] .'" target="blank"><font color="'$tick_color .'">'$ticker['title'] .'</font></a> '$ticksep .'';
                
$color++; 

The screenshot is what it does:

Eagle Creek 08-08-2006 06:14 PM

That's cool :D.
All of my news items are underlined. At your screenshot they aren't.

What's 'wrong'?

davidw 08-08-2006 07:03 PM

That happened to me one time because I was playing around with my FORUMHOME template and accidentally removed $spacer_open (right above where the $vbnews_ticker goes). Check there to see if it is located there. If not, you may want to put it in there.

Eagle Creek 08-08-2006 09:43 PM

Ahh.. My members don't like it.. :(.

But I have more forums. I will support this hack till the end! :D.

Buraq 08-09-2006 05:43 PM

Version 1.0.2 makes my forumhome load even slower (yes I did the edits to the php).

I'm not sure how feasible this is, but why not just include the latest thread titles via RSS instead of queries into the db. I know we implemented something like this on our main website, where we get the latest threads from a specific forum in vBulletin. I have to ask my co-admin how he did it.

Until then, I'm gonna have to disable this plugin. 14+ seconds is just too much, and sometimes the page doesn't load at all until you refresh again.

davidw 08-09-2006 07:39 PM

How many forums were you pulling these from? Also what other plugins were you running with this (in forumhome_complete)? I found this mod doesn't play well with vbshout, for example.

Buraq 08-09-2006 08:06 PM

Quote:

Originally Posted by christianb
How many forums were you pulling these from? Also what other plugins were you running with this (in forumhome_complete)? I found this mod doesn't play well with vbshout, for example.

I'm pulling threads from 2 forums, and the only other plugin I'm using is a banner rotator plugin I wrote. The banner plugin does not perform any complicated db queries or anything of the sort. It mainly just pulls a couple of variables stored in $vbulletin->options[] via an adminCP back end.

davidw 08-09-2006 08:20 PM

It should be ok then - I don't know why the delay. I'd be interested in the RSS transfer as that might speed things up - but I'm not sure how to do that. Of course, I've always had trouble with using marquees. I will be looking into speeding up the query though.

Eagle Creek 08-11-2006 03:34 PM

You fixed it? (cause I don't see your reply anymore)

davidw 08-11-2006 03:46 PM

I thought I did. lol
I fixed one thing, but removing that line cause it to pull more forums that were not chosen lol. The only reason why it was in there was for a preview - but for some reason it broke something else.

davidw 08-11-2006 03:58 PM

Ok, silly me, accidentally removed the WHERE statement because I thoughtlessly left it on the same line as the one I needed removed.

anyways, here's the potential fix (again)...

@Buraq (and anyone else who may be having a slow response time) - try editing the plugin and changing the query...

Find this:
PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                LEFT OUTER JOIN " 
TABLE_PREFIX "post AS post ON post.postid = t.firstpostid WHERE t.forumid IN (" implode(','$tickarray) . ") 
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

remove this code:
PHP Code:

LEFT OUTER JOIN " . TABLE_PREFIX . "post AS post ON post.postid t.firstpostid 

which changes it to this:
PHP Code:

            $gettickers $db->query_read("
                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid 
                FROM " 
TABLE_PREFIX "forum f 
                INNER JOIN " 
TABLE_PREFIX "thread t ON t.forumid = f.forumid AND t.visible = 1 AND " $desclim " > ( SELECT count(" $desclim ") FROM " TABLE_PREFIX "thread WHERE forumid = f.forumid AND visible = 1 AND dateline > t.dateline )
                WHERE t.forumid IN (" 
implode(','$tickarray) . ")
                ORDER BY field(f.forumid," 
implode(','$tickarray) . "), t.dateline desc
            "
); 

That code served no purpose and may actually be causing the problem. It is only used for allowing a preview of the post/thread and it is something I forgot to take out.
This will be fixed in the next version.

Battle_Ring 08-12-2006 12:19 AM

will this work with 3.6

davidw 08-12-2006 12:37 AM

Yes :)

doggy1 08-12-2006 07:08 PM

This appears to be a great hack and thank you for offering it. However, I had to remove it because it caused delays with members trying to post on the forum and every now and then an error message that the page could not be displayed would appear. Anyone else having this and is there a way to fix it? Thanks.

davidw 08-12-2006 07:13 PM

Which version did you use? Did you try the legacy version? Just curious.

doggy1 08-12-2006 09:20 PM

Quote:

Originally Posted by christianb
Which version did you use? Did you try the legacy version? Just curious.

I did not try the legacy version, but maybe if I learn to read I would have seen that you have addressed this already with this version. LOL!

I will this version and see what happens. Thanks for the reply!

:)

doggy1 08-12-2006 09:47 PM

Quote:

Originally Posted by christianb
for the second part, in the edit the plugin in the plugin manager, find vB News Ticker under forumhome_complete.
Look for &nbsp; &nbsp; and put a - (hyphen) in between the two &nbsp; symbols.

Product appears to now work! Thank you. Now.....

I am trying to find out how to get into forumhome_complete to add this hyphen. I am able to get to the edit section of the plugin manager but don't know how to get where I need to go for the edit.

Thanks!

davidw 08-12-2006 10:10 PM

Actually, you don't have to do that now - its in the adminCP :)
Just put something like
Code:

&nbsp; - &nbsp;
in the ticker separator.
Don't forget to click install :)

doggy1 08-12-2006 11:16 PM

Quote:

Originally Posted by christianb
Actually, you don't have to do that now - its in the adminCP :)
Just put something like
Code:

&nbsp; - &nbsp;
in the ticker separator.
Don't forget to click install :)

Worked perfectly and one click for this product! :)

I have to see if there is a way to change the colors and if you can put the feature on other pages, not just on forumhome. If so it will even be more awesome!

:D

davidw 08-12-2006 11:47 PM

The new version I changed it from forumhome_complete to global_start and I was able to use it in the header and on other pages. Just play around with that.

What did you have in mind on the colors?

doggy1 08-13-2006 12:52 AM

Quote:

Originally Posted by christianb
The new version I changed it from forumhome_complete to global_start and I was able to use it in the header and on other pages. Just play around with that.

What did you have in mind on the colors?

I will try to add it to the other pages.

As for the colors, it will probably be easier just to show you the hack on the forum. We do have several styles but it blends in too much with the surroundings. I'm still trying to decide on colors but take a look if you get the chance. Plus, other members here can see how well your hack is working! :)

Click here


All times are GMT. The time now is 05:01 AM.

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

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

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

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