Need help installing php code

Discussion in 'PHP' started by Rev Darkwing, May 22, 2008.

  1. #1
    I am trying to install a stock quote chart into a table on a .htm page. I have uploaded the php folder to my site and, when I go online and access the index.php page that is in it as an example, it works just fine. That would be inside the php folder like so www.mydomain.com/myphpfolder/index.php. That one works just fine.

    What i can't seem to do is to copy the code into the table on my htm page. Which looks like www.mydomain/myquotepage.htm When I copy the code for the entire index.php file into the table on my .htm page, it displays the table but not the quotes. Since it also displays some of the code in two of the cells, I know it is not accessing what it needs to in order to work. I cannot figure out from looking at the code, what I need to do to make this work. I am new to this php thing and am struggling to get my brain around it. Of course this is always the case for me so nothing new there. Any guidance would be greatly appreciated. Here is the code for the index.php file

    <?php

    require($_SERVER['DOCUMENT_ROOT']."/gcquotepro/includes/functions/func.gcquotepro.inc.php");

    $quote = _gc_DoChart("GOOG", $_SERVER['DOCUMENT_ROOT']."/gcquotepro/stock_temp/", 120);

    ?>
    <style type="text/css">
    p.center{
    text-align:center;
    }
    table#gtsqp_tbl{
    font-family:Verdana;
    border: 1px solid #3d56a6;
    font-size: 12px;
    margin: 5px auto;
    color: #000000;
    }
    table#gtsqp_tbl a, table#gtsqp_tbl a:visited{
    color: #FFFFFF;
    font-size: 12px;
    font-weight:bold;
    text-decoration:none;
    }
    table#gtsqp_tbl a:hover{
    color: #56668d;
    }
    table#gtsqp_tbl td{
    border: 1px solid #56668d;
    padding:2px;
    }
    table#gtsqp_tbl td.leftcol{
    background-color: #3d56a6;
    color: #FFFFFF;
    }
    table#gtsqp_tbl td.blank{
    border:none;
    }
    table#gtsqp_tbl p{
    padding:0;
    margin:0;
    }
    table#gtsqp_tbl .tableheader{
    background-color: #3d56a6;
    border: 1px solid #56668d;
    color: #FFFFFF;
    }
    table#gtsqp_tbl .tableheader p{
    text-align:center;
    }
    table#gtsqp_tbl .tablefooter{
    border: none;
    }
    table#gtsqp_tbl .tablefooter p{
    text-align:center;
    }
    table#gtsqp_tbl .tablefooter img{
    border: 1px solid #56668d;
    }
    </style>
    <table id="gtsqp_tbl">
    <tr>
    <td colspan="5" class="tableheader"><p><?php echo ucwords(strtolower($quote[stock_name]))." (<a href='http://finance.yahoo.com/q?d=t&amp;s=".$quote[stock_symbol]."'>".$quote[stock_symbol]."</a>)"; ?></p></td>
    </tr>
    <tr>
    <td class="leftcol"><p>Last Price:</p></td>
    <td><p><?php echo $quote[stock_last]; ?></p></td>
    <td rowspan="5" class="blank"></td>
    <td class="leftcol"><p>Day's Range:</p></td>
    <td><p><?php echo $quote[stock_low]." - ".$quote[stock_high]; ?></p></td>
    </tr>
    <tr>
    <td class="leftcol"><p>Change:</p></td>
    <td><p><img src="<?php if($quote[stock_change] > 0){ echo "images/up_arrow_g.gif"; } elseif($quote[stock_change] < 0){ echo "images/down_arrow_r.gif"; } else{ echo "images/blank.gif"; } ?>" alt="" /> <?php echo $quote[stock_change]." (".$quote[stock_percchange]."%)"; ?></p></td>
    <td class="leftcol"><p>52wk Range:</p></td>
    <td><p><?php echo $quote[stock_yrlow]." - ".$quote[stock_yrhigh]; ?></p></td>
    </tr>
    <tr>
    <td class="leftcol"><p>Last Trade:</p></td>
    <td><p><?php echo $quote[stock_date]." ".$quote[stock_tstamp]; ?></p></td>
    <td class="leftcol"><p>Volume:</p></td>
    <td><p><?php echo $quote[stock_volume]; ?></p></td>
    </tr>
    <tr>
    <td class="leftcol"><p>Prev Close:</p></td>
    <td><p><?php echo $quote[stock_prevclose]; ?></p></td>
    <td class="leftcol"><p>P/E:</p></td>
    <td><p><?php echo $quote[stock_pe]; ?></p></td>
    </tr>
    <tr>
    <td class="leftcol"><p>Open:</p></td>
    <td><p><?php echo $quote[stock_open]; ?></p></td>
    <td class="leftcol"><p>EPS:</p></td>
    <td><p><?php echo $quote[stock_eps]; ?></p></td>
    </tr>
    <tr>
    <td colspan="5" class="tablefooter"><p><?php echo "<img src='http://ichart.yahoo.com/t?s=".$quote[stock_symbol]."' alt='' />"; ?></p></td>
    </tr>
    </table>
    <p class="center"><?php _gc_About(); ?></p>
     
    Rev Darkwing, May 22, 2008 IP
  2. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Rename htm page to php e.g. myquotepage.php
     
    mwasif, May 22, 2008 IP
  3. Rev Darkwing

    Rev Darkwing Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    OK, I pasted the code into the table and saved the page at a .php file. This is the error I get.

    Site error: the file /home/mysite/public_html/gcquotepro/includes/functions/func.gcquotepro.inc.php requires the ionCube PHP Loader ioncube_loader_lin_5.2.so to be installed by the site administrator.


    Now, the ioncube PHP loader is on my server and the index.php page works perfectly when it is within its subfolder but move it out to the mydomain.com/index.php gives this error too. Obviously, I need change something in the code to reflect the fact that I have moved it from the mydomain.com/phpfolder/index.php.

    Some good news however... if I move the myquotepage.php that i created out of the myquotepage.htm file and put it into the mydomain.com/phpfolder/, then it also works so we are making progress. Now, if someone can help me find the snippet of code that I need to change when I move it out of the subfolder, I think I will be gold.
     
    Rev Darkwing, May 22, 2008 IP
  4. kasapa

    kasapa Peon

    Messages:
    86
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    why do you using .htaccess to mod-rewrite URL

    something like

     
    kasapa, May 23, 2008 IP