Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
stock market info Details »»
stock market info
Version: 1.00, by gsnindia gsnindia is offline
Developer Last Online: Apr 2020 Show Printable Version Email this Page

Category: Forum Home Enhancements - Version: 4.x.x Rating:
Released: 02-20-2014 Last Update: Never Installs: 2
Template Edits
Re-useable Code Code Changes Translations  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-24-2014, 03:49 AM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 02-27-2014, 02:30 PM
gsnindia gsnindia is offline
 
Join Date: Mar 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 02-27-2014, 02:34 PM
gsnindia gsnindia is offline
 
Join Date: Mar 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:50 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.04031 seconds
  • Memory Usage 2,248KB
  • Queries Executed 18 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete