vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=246)
-   -   Forum Home Enhancements - stock market info (https://vborg.vbsupport.ru/showthread.php?t=308698)

gsnindia 02-20-2014 11:00 PM

stock market info
 
1 Attachment(s)
I haven't found any stock market info for vb 4 yet that provide information for any stock market stock or exchange

I have created my own , sharing with you all


How To Install
Step.1:
Please take backup of forum.php before performing this task >> go to forum.php in the last page after
Code:

else
{
        $show['wgo_members']= false;
}

Put this code : You may change the stock array as per your requirement , we use the stock code from Google finance ($Arraysymbol = array("NSE:NIFTY", "NSE:CNXMIDCAP", "NSE:CNX500","NSE:CNX100");)

Code:

$Arraysymbol = array("NSE:NIFTY", "NSE:CNXMIDCAP", "NSE:CNX500","NSE:CNX100");
//Obtain Quote Info - This collects the Microsoft Stock Info
 ($hook = vBulletinHook::fetch_hook('prodforums_sensex_bit')) ? eval($hook) : false;
foreach ($Arraysymbol as $i => $value) {
 
 $quote = file_get_contents('http://www.google.com/finance/info?infotype=infoquoteall&q='. $Arraysymbol[$i]);
 
  //Remove CR's from ouput - make it one line
  $json = str_replace("\n", "", $quote);
 
  //Remove //, [ and ] to build qualified string 
  $data = substr($json, 4, strlen($json) -5);
    //decode JSON data
  $json_output = json_decode($data, true);
 
  //Un-remark print_r to see all array keys
  //print_r($json_output);
      $templater = vB_Template::create('stock_information_bit');
                $templater->register('name', $json_output['name']);
                $templater->register('date', $json_output['lt']);
                $templater->register('live', $json_output['l']);
                $templater->register('change', $json_output['c']);
                $templater->register('changep', $json_output['cp']);
                $templater->register('open', $json_output['op']);
                $templater->register('high', $json_output['hi']);
                $templater->register('low', $json_output['lo']);
                $templater->register('hi52', $json_output['hi52']);
                $templater->register('lo52', $json_output['lo52']);
                $resultsbits .= $templater->render();
                 
  }
// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTTA HERE... ###
($hook = vBulletinHook::fetch_hook('forumhome_complete')) ? eval($hook) : false;

$navbits = construct_navbits($navbits);
$navbar = render_navbar_template($navbits);
$templater = vB_Template::create('FORUMHOME');
        $templater->register_page_templates();
        $templater->register('activemembers', $activemembers);
        $templater->register('activeusers', $activeusers);
        $templater->register('ad_location', $ad_location);
        $templater->register('birthdays', $birthdays);
        $templater->register('forumbits', $forumbits);
        $templater->register('resultsbits', $resultsbits);
        $templater->register('navbar', $navbar);
        $templater->register('newuserinfo', $newuserinfo);
        $templater->register('numberguest', $numberguest);
        $templater->register('numbermembers', $numbermembers);
        $templater->register('numberregistered', $numberregistered);
        $templater->register('recorddate', $recorddate);
        $templater->register('recordtime', $recordtime);
        $templater->register('recordusers', $recordusers);
        $templater->register('template_hook', $template_hook);
        $templater->register('today', $today);
        $templater->register('totalonline', $totalonline);
        $templater->register('totalposts', $totalposts);
        $templater->register('totalthreads', $totalthreads);
        $templater->register('upcomingevents', $upcomingevents);
        $templater->register('sidebar', $sidebar);
        $templater->register('close_sidebar', $close_sidebar);
        $templater->register('sidebar_class', $sidebar_class);
        $templater->register('wgo_members',$wgo_members);
        $templater->register('wgo_members_list',$wgo_members_list);
print_output($templater->render());

Step 2
Create Template with name "stock_information_bit" paste the following code

Code:

<vb:if condition="$change > 0">
<td bgcolor=green>
</vb:if>
<vb:if condition="$change < 0">
<td bgcolor=red>
</vb:if>                        <div class="tMrktDtl">
                        <div class="boxDtl" >
<div style="color:#FFFFFF"><strong>{vb:raw date}</strong></div>
                        <div style="color:#FFFFFF"><strong>{vb:raw name}</strong></div>
                        <div class="FL">
                        <p style="color:#FFFFFF"> <span></span> <span ><strong>{vb:raw live}</strong></span> <span class="gn_13">{vb:raw change}({vb:raw changep}%)</span> </p>
                        </div>
                        </div>
</td>

step 3
Open the forumhome tempate

Just after
Code:

        {vb:raw header}

        {vb:raw navbar}


add the following

Code:

  <table  width="100%">
<div>
<tr>
<td><div><span font">MARKETS</span><br>
                        <span >TODAY</span><br>
                        <span ><script type="text/javascript">
var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
document.write(day + "/" + month + "/" + year);
</script></span>
                </div>
</td>
                  {vb:raw resultsbits}
</tr>
</div>
</table>

and your are done

check the result in http://www.gsnindia.com

when the market is down it shows in red , when market is Up it shows in green

You are done

Check The Images http://www.gsnindia.com/images/stockicon/marketshow.png

DemOnstar 02-24-2014 03:49 AM

Is it possible do you think to make a forum block and CMS widget using this code?
My site is not financially motivated but it could be a nice addition..

Well done to you for making such a thing.

gsnindia 02-27-2014 02:30 PM

Yes it is possible , one need to change the block_html template also. I did to integrated with the Home page without disturbing other codes and templates.

I have many more changes in the forum Like Charting , Portfolio management , Only i have not made any product of it.

Check the Data table ( Historical chart table, Chart and other features.)

http://www.gsnindia.com/smartstock.p...ory&symbol=ABB

I have integrated the Amcharts and YUI data tables.

gsnindia 02-27-2014 02:34 PM

I am Looking to partner with someone who have good knowledge of Vbulletin product development knowledge . I have great Idea and very well resource integration accuman. Only need some one to code and implement.

You know how to connect with me.

I have plan to have International Online web application developed.


All times are GMT. The time now is 09:13 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.01131 seconds
  • Memory Usage 1,741KB
  • 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
  • (5)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete