Back to vBulletin 4.x Template Modifications

Stock market Status ( forum and CMS)
Mod Version: 1.00, by gsnindia

vB Version: 4.2.1 Rating: (0 vote - 0 average) Installs: 5
Released: 08 Mar 2014 Last Update: Never Downloads: 0
Not Supported Re-usable Code Translations External Content  

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 workinghttp://www.gsnindia.com/content/

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024