Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: New to php and I screwed things up

  1. #1
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy New to php and I screwed things up

    Below is the code to a document called app_layout_home.php. Not realizing that you could edit a doc's text from a webhost's cpanel (first mistake), I downloaded the php file and edited it in Nvu portable. I changed ONE line of code (in the html of all places --> near the bottom, it is the copyright date). Then I reuploaded the file and the result is this:

    http://www.ehaplanners.com/index.php

    the html gets rendered, but the php is not parsed.

    All of the other pages work correctly (they use separate app_layout_"pagename".php files). Here is a properly functioning one:

    http://www.ehaplanners.com/index.php?fuseaction=AboutUs

    Could someone please help me figure out the problem? I am such a novice. Any help would be greatly appreciated.

    Kyle





    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    &lt;?
    $layout = "

    <html>
    <head>
    <title>".$allsettings["setting_sitename"]."</title>
    <script language='Javascript'>
    startList = function() {
    if (document.all&&document.getElementById) {
    navRoot = document.getElementById('nav');
    for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=='LI') {
    node.onmouseover=function() {
    this.className+=' over';
    }
    node.onmouseout=function() {
    this.className=this.className.replace(' over', '');
    }
    }
    }
    navRoot2 = document.getElementById('nav2');
    for (i=0; i<navRoot2.childNodes.length; i++) {
    node = navRoot2.childNodes[i];
    if (node.nodeName=='LI') {
    node.onmouseover=function() {
    this.className+=' over';
    }
    node.onmouseout=function() {
    this.className=this.className.replace(' over', '');
    }
    }
    }
    }
    }
    window.onload=startList;
    </script>
    <style>
    BODY{scrollbar-3dlight-color : #B4CDEC;



    ... boring CSS stuff......



    </style>

    </head>

    <body topmargin="0" leftmargin="0" rightmargin="0">

    <ul id="nav" style="margin: 0pt; padding: 0pt; list-style-type: none; position: absolute; top: 190px; left: 250px;">

    <li><a href="%22.$site_url.%22Services"><img src="images/spacer.gif" border="0" height="20" width="95"></a>
    <ul>

    <li><a href="%22.$site_url.%22LandPlanningServices">Land
    Planning Services</a></li>

    <li><a href="%22.$site_url.%22ExpertWitnessTestimony">Expert
    Witness Testimony</a></li>

    <li><a href="%22.$site_url.%22UrbanDesignLandscapeArchitecture">Urban
    Design &amp; Landscape Architecture</a></li>

    <li><a href="%22.$site_url.%22DevelopmentofRegionalImpact">Development
    of Regional Impact</a></li>

    <li><a href="%22.$site_url.%22SpecialStudies">Special
    Studies</a></li>

    <li><a href="%22.$site_url.%22RepresentativeClients">Representative
    Clients</a></li>

    </ul>

    </li>

    </ul>

    <table bgcolor="white" border="0" cellpadding="0" cellspacing="0" width="100%">

    <tbody>

    <tr>

    <td colspan="2" background="images/header_background.gif" height="92" width="100%">
    <table cellpadding="0" cellspacing="0" width="100%">

    <tbody>

    <tr>

    <td><a href="%22.$site_url.%22Home"><img src="images/header_left.gif" alt="" border="0" height="92" width="357"></a></td>

    <td align="right"><a href="%22.$site_url.%22ContactUs"><img src="images/header_right.gif" alt="" border="0" height="92" width="364"></a></td>

    </tr>

    </tbody>
    </table>

    </td>

    </tr>

    <tr>

    <td colspan="2" background="images/pic_top_background.gif" height="93" width="100%"><img src="images/pic_top.gif" alt="" border="0" height="93" width="750">
    </td>

    </tr>

    <tr>

    <td colspan="2" background="images/menu_top_background.gif" height="24" width="100%"><img src="images/menu_top.gif" alt="" usemap="#menu_top" border="0" height="24" width="750">
    </td>

    </tr>

    <tr height="106">

    <td valign="top" width="176"><img src="images/pic_menu.gif" alt="" border="0" height="106" width="176">
    </td>

    <td style="padding-right: 2px;" rowspan="2" valign="top">
    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">

    <tbody>

    <tr>

    <td height="25" width="8"><img src="images/content_topleft.gif" alt="" border="0" height="25" width="8"></td>

    <td style="padding-bottom: 4px;" background="images/content_header.gif" height="25" valign="bottom"><img src="images/spacer.gif" alt="" border="0" height="1" width="1"><img src="images/title_%22.strtolower%28$fuseaction%29.%22.gif" alt="" border="0"></td>

    <td height="25" width="8"><img src="images/content_topright.gif" alt="" border="0" height="25" width="8"></td>

    </tr>

    <tr>

    <td background="images/content_left.gif"> <img src="images/spacer.gif" alt="" border="0" height="1" width="1"> </td>

    <td style="padding-left: 5px;" padding-right:10="" padding-top:10="" padding-bottom:10="" bgcolor="#e9e9e9">
    <div align="justify">".$bodycontent."</div>

    </td>

    <td background="images/content_right.gif"> <img src="images/spacer.gif" alt="" border="0" height="1" width="1"> </td>

    </tr>

    <tr>

    <td height="14"><img src="images/content_bottomleft.gif" alt="" border="0" height="14" width="8"></td>

    <td background="images/content_footer.gif" height="14" valign="top"><img src="images/spacer.gif" alt="" border="0" height="1" width="1"></td>

    <td height="14"><img src="images/content_bottomright.gif" alt="" border="0" height="14" width="8"></td>

    </tr>

    </tbody>
    </table>

    </td>

    </tr>

    <tr>

    <td background="images/leftmenu_background.gif" valign="top" width="176"> <input name="fuseaction" value="SearchNow" type="hidden">
    <table border="0" cellpadding="0" cellspacing="0" height="100%" width="176">

    <tbody>

    <tr>

    <td height="17"><img src="images/search_keywords.gif" alt="" border="0" height="18" width="176"></td>

    </tr>

    <form action="index.php" method="post"></form>

    <tr>

    <td style="padding-left: 5px; padding-top: 5px; padding-bottom: 5px;" background="images/leftmenu_background.gif"> <input name="keywords" maxlength="35" size="15" type="text"> <input src="images/button_search.gif" align="center" type="image"> </td>

    </tr>

    <tr>

    <td height="16"><img src="images/latest_news.gif" alt="" border="0" height="16" width="176"></td>

    </tr>

    <tr>

    <td style="padding-left: 10px; padding-right: 10px;" background="images/leftmenu_background.gif"> ".$news." </td>

    </tr>

    </tbody>
    </table>

    </td>

    </tr>

    <tr>

    <td colspan="2" background="images/menu_bottom_row_background.gif" height="12" width="100%"><img src="images/menu_bottom_row.gif" alt="" border="0" height="12" width="750"></td>

    </tr>

    <tr>

    <td colspan="2" background="images/menu_bottom_background.gif" height="26" width="100%"><img src="images/menu_bottom.gif" alt="" usemap="#menu_bottom" border="0" height="26" width="750"></td>

    </tr>

    <tr>

    <td colspan="2" align="center" background="images/footer.gif" height="53" valign="middle" width="100%">&copy; 2007
    Engelhardt, Hammer &amp; Associates, Inc.</td>

    </tr>

    </tbody>
    </table>

    <ul id="nav2" style="margin: 0pt; padding: 0pt; list-style-type: none; position: relative; top: -75px; left: 260px;">

    <li><a href="%22.$site_url.%22Services"><img src="images/spacer.gif" border="0" height="20" width="90"></a>
    <ul>

    <li><a href="%22.$site_url.%22LandPlanningServices">Land
    Planning Services</a></li>

    <li><a href="%22.$site_url.%22ExpertWitnessTestimony">Expert
    Witness Testimony</a></li>

    <li><a href="%22.$site_url.%22UrbanDesignLandscapeArchitecture">Urban
    Design &amp; Landscape Architecture</a></li>

    <li><a href="%22.$site_url.%22DevelopmentofRegionalImpact">Development
    of Regional Impact</a></li>

    <li><a href="%22.$site_url.%22SpecialStudies">Special
    Studies</a></li>

    <li><a href="%22.$site_url.%22RepresentativeClients">Representative
    Clients</a></li>

    </ul>

    </li>

    </ul>

    <map name="header">
    <area alt="Home" coords="2,0,348,81" href="%22.$site_url.%22Home">
    <area alt="Email Us!" coords="579,46,738,59" href="%22.$site_url.%22ContactUs">
    </map>

    <map name="menu_top">
    <area shape="RECT" coords="101,0,101,0">
    <area alt="Home" coords="102,0,172,24" href="index.php">
    <area alt="About Us" coords="173,1,258,26" href="%22.$site_url.%22AboutUs">
    <area alt="Services" coords="259,0,348,24" href="%22.$site_url.%22Services">
    <area alt="Staff" coords="349,0,418,24" href="%22.$site_url.%22Staff">
    <area alt="Careers" coords="419,0,497,25" href="%22.$site_url.%22Careers">
    <area alt="Links" coords="498,0,565,24" href="%22.$site_url.%22Links">
    <area alt="Contact Us" coords="566,1,661,25" href="%22.$site_url.%22ContactUs">
    </map>

    <map name="menu_bottom">

    <!--same as map menu top>

    </map>

    </body>
    </html>

    ";
    print $layout;
    ?&gt;

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Change:

    Code:
    ";
    print $layout;
    ?&gt;
    to:

    PHP Code:
    <?php
    print $layout;
    ?>
    You have changed the actual php coding tags to HTML, so the browser/server sees them as HTML not PHP.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    that did not seem to work. nothing changed on the output --> it still renders as :

    http://www.ehaplanners.com/index.php

    I shouldn't have to insert <?php again should I? It is at the very top defining the variable $layout

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Oops, my bad. I didn't see that one.

    the same thing has happened to the top one as well. It should be the <?php
    and then end with ?> at the bottom.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default still didn't work

    it now gives me a php parse error on line 155

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Oh dear me. LOL okay I took a closer look now and I see what happened.

    ALL the php code that was on the page was turned into the HTML equivalent.

    Do you have the original php file anywhere?

    If not post the complete file, or better yet, put it in a zip file and attach it here so I (we) can help fix it.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Jan 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default semi-original

    I was not here when the site was created, but I (stupidly) assumed that a backup was readily available. That not being the case, I am trying to get our IT guy to get a backup of the files (hopefully that will be fruitful).

    I attached a zip of the file that I replaced the original with --> at the very beginning, I dl the app_layout_home.php file and edited it with Nvu, then reuploaded it. Something tells me that Nvu did not resave as a clean text file...

    The attached file is a result of that, after I have edited it some using the cpanel of our hosting company.

    Hope that all makes sense... I really do appreciate your help man

  8. #8
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Okay I have the file, I will look at it and begin the fixing.

    no promises on the time frame, there is a lot of code to go through. I will do it as speedily as I can though.

    (If any other coder out there wants to help feel free )
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. #9
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Found problem, fixing code, will post when finished.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  10. #10
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Ok, found the problem and it was with the quotes you put in the code. I fixed the code, and it is attached below. Please go through the code to see what I have done to fix it.

    Hope this hleps.

    Attachment 733
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •