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)
-   -   vBulletin CMS Widgets - Stock market Status ( forum and CMS) (https://vborg.vbsupport.ru/showthread.php?t=309297)

gsnindia 03-07-2014 11:00 PM

Stock market Status ( forum and CMS)
 
1 Attachment(s)
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

https://vborg.vbsupport.ru/attachmen...1&d=1394305913

tbworld 03-08-2014 05:41 AM

I think members will like this. Thanks for sharing! :)

Thangvip9x 03-08-2014 12:23 PM

Please screenshots

DemOnstar 03-08-2014 12:45 PM

This would be even better if I had any money.

Is there a complete list of symbols available anywhere?

Great idea.

faisaly.com 03-08-2014 06:12 PM

1 Attachment(s)
https://vborg.vbsupport.ru/attachmen...1&d=1394305913

gsnindia 03-11-2014 04:46 AM

Quote:

Originally Posted by DemOnstar (Post 2485883)
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

gsnindia 03-11-2014 04:47 AM

Quote:

Originally Posted by faisaly.com (Post 2485942)

Thanks for sharing the image

DemOnstar 03-11-2014 03:34 PM

Quote:

Originally Posted by gsnindia (Post 2486345)
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.


All times are GMT. The time now is 11:51 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.01143 seconds
  • Memory Usage 1,752KB
  • 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
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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