vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Add-On Releases - vB News Ticker - Your Blogs RSS Feeds and Forums in a Marquee (https://vborg.vbsupport.ru/showthread.php?t=207432)

davidw 04-04-2009 01:41 PM

If you want the shorthand approach, you could essentially copy the product and rename it. Then open it with a text editor or what-not - rename every variable that has a $ before it and add a 1 or whatever after it. Also, every instance in the setting and phrase will need to have their names adjusted as well (phrase before the _desc and _title)
You will want to rename these or it will only overwrite the product
<product productid="davidw_vbnews_ticker" active="1">
<title>vB News Ticker</title>
<description>Latest News in a Ticker</description>

This should give you a starting point.

-or-


Another quicker way that might work is this:

Edit the xml and find instances of $ticker_titles
Edit that variable on the forumids that you want in the different forums.
Example:
Code:

                if (fid2) {
                        $gettickers2 = $db->query_read("
                                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid, t.prefixid
                                FROM " . TABLE_PREFIX . "forum f
                                INNER JOIN " . TABLE_PREFIX . "thread t ON t.forumid = f.forumid
                                WHERE t.forumid = " . $fid2 . "
                                ORDER BY dateline DESC
                                LIMIT " . $desclim . "
                        ");
               
                        while($ticker = $db->fetch_array($gettickers2))
                        {
                                $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['prefix_rich']        = $vbphrase["prefix_$ticker[prefixid]_title_rich"];
                                $ticker_titles                        .= '<a style="text-decoration:none" href="showthread.php?t='. $ticker['threadid'] .'" title="'. $ticker['title'] .'" target="blank"><font color="#'. $tickcolor .'">'. $ticker['prefix_rich'] .' '. $ticker['title'] .'</font></a> '. $ticksep.'';
                        }
                }

and change to
Code:

                if (fid2) {
                        $gettickers2 = $db->query_read("
                                SELECT t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid, t.prefixid
                                FROM " . TABLE_PREFIX . "forum f
                                INNER JOIN " . TABLE_PREFIX . "thread t ON t.forumid = f.forumid
                                WHERE t.forumid = " . $fid2 . "
                                ORDER BY dateline DESC
                                LIMIT " . $desclim . "
                        ");
               
                        while($ticker = $db->fetch_array($gettickers2))
                        {
                                $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['prefix_rich']        = $vbphrase["prefix_$ticker[prefixid]_title_rich"];
                                $ticker_titles2                        .= '<a style="text-decoration:none" href="showthread.php?t='. $ticker['threadid'] .'" title="'. $ticker['title'] .'" target="blank"><font color="#'. $tickcolor .'">'. $ticker['prefix_rich'] .' '. $ticker['title'] .'</font></a> '. $ticksep.'';
                        }
                }

added the 2 after $ticker_titles
then duplicate the templates
from
Code:

        <templates>
                <template name="vbnews_ticker" templatetype="template" date="0" username="davidw" version="2.0.2"><![CDATA[<if condition="is_member_of($vbulletin->userinfo,$tickugp)"><div align="center" style="padding:2px; z-index: -1; background-color:#{$vboptions[tickbgcol]}; layer-background-color:#{$vboptions[tickbgcol]}";><marquee width="{$vboptions[tickwidth]}%" height="{$vboptions[tickheight]}" behavior=scroll scrollamount="{$vboptions[tickspeed]}" onmouseover="this.stop()" onmouseout="this.start()"><font color="#{$vboptions[tickcolor]}">$tickpre</font> $ticker_titles</marquee></div></if>]]></template>
        </templates>

to
Code:

        <templates>
                <template name="vbnews_ticker" templatetype="template" date="0" username="davidw" version="2.0.2"><![CDATA[<if condition="is_member_of($vbulletin->userinfo,$tickugp)"><div align="center" style="padding:2px; z-index: -1; background-color:#{$vboptions[tickbgcol]}; layer-background-color:#{$vboptions[tickbgcol]}";><marquee width="{$vboptions[tickwidth]}%" height="{$vboptions[tickheight]}" behavior=scroll scrollamount="{$vboptions[tickspeed]}" onmouseover="this.stop()" onmouseout="this.start()"><font color="#{$vboptions[tickcolor]}">$tickpre</font> $ticker_titles</marquee></div></if>]]></template>
                <template name="vbnews_ticker2" templatetype="template" date="0" username="davidw" version="2.0.2"><![CDATA[<if condition="is_member_of($vbulletin->userinfo,$tickugp)"><div align="center" style="padding:2px; z-index: -1; background-color:#{$vboptions[tickbgcol]}; layer-background-color:#{$vboptions[tickbgcol]}";><marquee width="{$vboptions[tickwidth]}%" height="{$vboptions[tickheight]}" behavior=scroll scrollamount="{$vboptions[tickspeed]}" onmouseover="this.stop()" onmouseout="this.start()"><font color="#{$vboptions[tickcolor]}">$tickpre</font> $ticker_titles2</marquee></div></if>]]></template>
        </templates>

Add this new template to the cache_templates plugin array
and then find this:
Code:

eval('$vbnews_ticker .= "' . fetch_template('vbnews_ticker') . '";');
copy this line and change your new line to reflect your new template. For example:
Code:

eval('$vbnews_ticker .= "' . fetch_template('vbnews_ticker') . '";');
eval('$vbnews_ticker2 .= "' . fetch_template('vbnews_ticker2') . '";');

I've not tested this, but something like this should work.

jaryx 05-13-2009 09:51 AM

Mod is great, but... when I enable it in the CPU time used by scripts PHP/CGI jump up by 100%.
I could do something bad, is it normal?

davidw 05-13-2009 10:54 AM

I'm not sure why this mod alone would cause 100% CPU usage but marquees have a tendency to increase the CPU usage of the page.

Tboy_forum 05-27-2009 01:57 PM

What is the selection criteria for each forum?

Lets say I have 2 forums with 3 news items selected - which threads from those forums are selected?

davidw 05-27-2009 02:28 PM

You have a limit that you set on the latest. They pertain to the latest (newest) created threads. If you set 3 as the limit for 2 forums, it would take the latest 3 created threads from those 2 forums.

Tboy_forum 05-27-2009 08:01 PM

Thanks for the info there - much appreciated

Our threads on the forum are ordered by last post

Is it possible to modify the code to select the last eg. 3 updated threads. Problem I am having is that for our events, threads were created a while back and get updated daily or every second day..

This means that although the thread is updated today ( and showing first on the forum list), its the older (events passed) links which are showing up on the ticker (according to your selection criteria) since their created date is newer than the last updated thread - hope that makes sense:p

In short I want to be able to select the last 3 posts which were updated - and not by thread creation date

Your help would be appreciated:D

davidw 05-27-2009 11:47 PM

Try something like this...

Code:

SELECT t.lastpost, t.threadid, t.title, t.forumid, t.open, t.dateline, t.visible, t.firstpostid, t.prefixid
                FROM " . TABLE_PREFIX . "forum f
                INNER JOIN " . TABLE_PREFIX . "thread t ON t.forumid = f.forumid
                LEFT OUTER JOIN " . TABLE_PREFIX . "post AS post ON post.postid = t.firstpostid WHERE t.forumid = " . $fidX . "
                ORDER BY lastpost DESC
                LIMIT " . $desclim . "

Amend where necessary ($fidX) This should give you results based on last post.

Also, if the variables are different, change them as I have not tested the script - only tested in phpmyadmin.

Tboy_forum 05-28-2009 07:25 AM

Thanks a stack - that works!!

Much obliged

masterweb 06-01-2009 03:35 PM

Thanks for the demo CFodder ;)

nnStaff 06-03-2009 10:33 AM

Nice; now if the users could select the feeds it'd be even better.


All times are GMT. The time now is 03:12 PM.

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.01151 seconds
  • Memory Usage 1,759KB
  • 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
  • (7)bbcode_code_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
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

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

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