Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Stock market Status ( forum and CMS) Details »»
Stock market Status ( forum and CMS)
Version: 1.00, by gsnindia gsnindia is offline
Developer Last Online: Apr 2020 Show Printable Version Email this Page

Category: vBulletin CMS Widgets - Version: 4.2.1 Rating:
Released: 03-07-2014 Last Update: Never Installs: 5
Re-useable Code Translations  
No support by the author.

Create New Widget for PHP direct Execution It shows stock market status

copy and paste the following code and place

just change the array symbol as per your requirement. $Arraysymbol = array("NSE:NIFTY", "NSE:CNXMIDCAP", "NSE:CNX500","NSE:CNX100");

PHP Code:
$Arraysymbol = array("NSE:NIFTY""NSE:CNXMIDCAP""NSE:CNX500","NSE:CNX100");
//Obtain Quote Info - This collects the Microsoft Stock Info
$output .="<style>
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
table,th,td
{
border:1px solid black;
}
</style>"
;
 
$output .= "<table><thead><tr>
      <th>Index</th>
      <th>Current</th>
      <th>change</th>
      <th>Percent</th>
    </tr>
  </thead>
 <tbody>"
;
 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($json4strlen($json) -5);
    
//decode JSON data
  
$json_output json_decode($datatrue);
   
$output .= "<tr><td>"$json_output['name']. "</td><td>".  $json_output['l'] . "</td><td>".  $json_output['c'] . "</td><td>".  $json_output['cp'] . "</td></tr>";
  
}
 
$output .= "  </tbody>
</table>"

you are done.

You can add in forum block also ....

Create New Forum Block with PHP selection and cut paste the below code --- Remember to change symbol as per your requirement

PHP Code:
$Arraysymbol = array("NSE:NIFTY""NSE:CNXMIDCAP""NSE:CNX500","NSE:CNX100");
//Obtain Quote Info - This collects the Microsoft Stock Info
$output .="<style>
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
table,th,td
{
border:1px solid black;
}
</style>"
;
 
$output .= "<table><thead><tr>
      <th>Index</th>
      <th>Current</th>
      <th>change</th>
      <th>Percent</th>
    </tr>
  </thead>
 <tbody>"
;
 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($json4strlen($json) -5);
    
//decode JSON data
  
$json_output json_decode($datatrue);
   
$output .= "<tr><td>"$json_output['name']. "</td><td>".  $json_output['l'] . "</td><td>".  $json_output['c'] . "</td><td>".  $json_output['cp'] . "</td></tr>";
  
}
 
$output .= "  </tbody>
</table>"




check the working here

Show Your Support

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

Comments
  #2  
Old 03-08-2014, 05:41 AM
tbworld tbworld is offline
 
Join Date: Oct 2008
Posts: 2,126
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I think members will like this. Thanks for sharing!
Reply With Quote
  #3  
Old 03-08-2014, 12:23 PM
Thangvip9x Thangvip9x is offline
 
Join Date: Apr 2012
Location: Yen Bai, Vietnam
Posts: 106
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please screenshots
Reply With Quote
  #4  
Old 03-08-2014, 12:45 PM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This would be even better if I had any money.

Is there a complete list of symbols available anywhere?

Great idea.
Reply With Quote
  #5  
Old 03-08-2014, 06:12 PM
faisaly.com faisaly.com is offline
 
Join Date: Mar 2007
Posts: 226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Attached Images
File Type: png 2014-03-08_141028.png (4.3 KB, 0 views)
Reply With Quote
  #6  
Old 03-11-2014, 04:46 AM
gsnindia gsnindia is offline
 
Join Date: Mar 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DemOnstar View Post
This would be even better if I had any money.

Is there a complete list of symbols available anywhere?

Great idea.
Yes you can Use Google finance symbol lists
Reply With Quote
  #7  
Old 03-11-2014, 04:47 AM
gsnindia gsnindia is offline
 
Join Date: Mar 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by faisaly.com View Post
Thanks for sharing the image
Reply With Quote
  #8  
Old 03-11-2014, 03:34 PM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gsnindia View Post
Yes you can Use Google finance symbol lists
Thanks.

Could you point me to that page with a link please?

Also, if you wish to develop the mod further, how about allowing the ordinary user to have the ability to input their own list for the widget/forum block? A list that they are interested in.
Users are from all over the world and perhaps they are interested in different markets.

Not sure at all how you would accomplish this. Perhaps a couple of user profile fields that are filled in by the user and read by your mod?

I don't know really..

Good work sir and thanks for your interest in keeping vB 4 afloat and ahead of the rest.
Reply With Quote
Reply


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 12:34 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.07373 seconds
  • Memory Usage 2,308KB
  • Queries Executed 22 (?)
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
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (7)postbit
  • (1)postbit_attachment
  • (8)postbit_onlinestatus
  • (8)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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete