+ Reply to Thread
Results 1 to 10 of 10

Thread: PHP Issue

  1. #1
    ivankoumaev is offline x10Hosting Member ivankoumaev is an unknown quantity at this point
    Join Date
    Apr 2009
    Posts
    4

    PHP Issue

    I am trying to add a news page to my site using PHP. But the problem is that, even after I add in the coding, the webpage doesn't show up. I've checked and triple checked the URL's and everything is spelled correctly and working properly. It just won't show up on the page [http://ivankoumaev.exofire.net] for some reason.

    I'm using this code:
    Code:
     
    <?PHP
    $number=15;
    include("/home/ikweb/public_html/cutenews/show_news.php");
    ?>
    Does anyone know what I'm doing wrong? Any help would be very much appreciated!

  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: PHP Issue

    Quote Originally Posted by ivankoumaev View Post
    I am trying to add a news page to my site using PHP. But the problem is that, even after I add in the coding, the webpage doesn't show up. I've checked and triple checked the URL's and everything is spelled correctly and working properly. It just won't show up on the page [http://ivankoumaev.exofire.net] for some reason.

    I'm using this code:
    Code:
     
    <?PHP
    $number=15;
    include("/home/ikweb/public_html/cutenews/show_news.php");
    ?>
    Does anyone know what I'm doing wrong? Any help would be very much appreciated!
    include's a relative include, which is fine but your path is starting too early.

    Since all of your scripts are already being ran out of /home/ikweb/public_html, drop that whole section from your include and try this:

    Code:
    <?php
    $number=15;
    include("/cutenews/show_news.php");
    ?>
    The key to remember is the include path defaults to where the calling file is in, ergo if index.php is in /home/ikweb/public_html, don't put that in the include - put the rest and it should work fine
    Last edited by Livewire; 05-01-2009 at 07:34 PM.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: PHP Issue

    To add to what Livewire said, make sure your page has some output, otherwise it will be (correctly) a blank page
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  4. #4
    ivankoumaev is offline x10Hosting Member ivankoumaev is an unknown quantity at this point
    Join Date
    Apr 2009
    Posts
    4

    Re: PHP Issue

    Thank you both for replying so quickly!

    I tried shortening the path, but that doesn't seem to help it any. I'm partially convinced that the problem is in my index.html file, because I've been trying to add other images to the same table and they aren't showing up either. Although I'm not exactly sure what output is, which may be part of my problem. Haha, it's been so many years since I did any serious stuff!

    Ah, anyway, I hate to post so much on here when I'm sure most of it isn't needed, but here's the code for my index.html page.

    Code:
    <html>
    <head>
    <title>The Official Ivan Koumaev Fansite</title>
    </head>
    <style type="text/css">
    <!--
     BODY
    .style13 {font-size: 14px}
    .style15 {
     font-size: 12px;
     font-weight: bold;
     color:black;
    }
    .style3 { font-family: Verdana, Arial, Helvetica, sans-serif;
     font-size: 12px;
    }
    .style5 { font-size: 14px;
     font-weight: bold;
    }
    a:link {
     color:black;
     text-decoration: none;
    }
    a:visited {
     text-decoration: none;
     color:black;
    }
    a:hover {
     text-decoration: none;
     color:lavender;
    }
    a:active {
     text-decoration: none;
     color:black;
    }
    .style16 {color:black}
    .style17 {
     color:black;
     font-weight: bold;
    }
    body {
      background: url("/images/background2.png");
    }
    -->
    </style>
    <font face=verdana>
    <font size=2>
    <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div style="position:absolute; left:0; top:0;">    
    <img src="/images/header.png">
    </div>
    <div style="position:absolute; left:170; top:170; width:150; background;">
    <table background="/images/background.png"><tr><td>
    <iframe
    src="http://ivankoumaev.exofire.net/home.html" id="home" name="home" frameborder=0 allowtransparency="true">
    </iframe>
    <br><br>
    <script type="text/javascript">
    //new fadeshow("/opening.html", slideshow_width, slideshow_height, borderwidth, delay, pause (0=no, 1=yes), optionalRandomOrder)
    new fadeshow(fadeimages, 140, 225, 0, 3000, 1, "R")
    new fadeshow(fadeimages2, 140, 225, 0, 3000, 0)
     
    </script>
    </tr></td></table>
    
    // Then the rest seems to be working all right.
    Thank you both again for taking the time to help me! I'm sure I must be bothersome what with my lack of understanding for anything that I'm doing.

  5. #5
    garrensilverwing's Avatar
    garrensilverwing is offline x10 Sophmore garrensilverwing is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    148

    Re: PHP Issue

    i think i see your problem

    at the beginning of your document paths you have a / that ought not be there try removing those slashes and see if that helps

    Code:
    body {
      background: url("images/background2.png");
    }

  6. #6
    olliepop's Avatar
    olliepop is offline x10 Sophmore olliepop is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    137

    Re: PHP Issue

    To go up a level when including files or inserting images you use the ol'
    Code:
    ..
    For example, if i had an image at tribalcorp.net/image.gif and i wanted to show it from tribalcorp.net/show/page.php i would do this:

    [code]
    <?php

    echo "<img src='../image.gif' />";

    ?>
    [code]

    maybe that helps? if its a directory problem.
    and i highly recommend converting the name to index.php if your using cutenews as a part of your site. highly

  7. #7
    David's Avatar
    David is offline IRC: For Cool People! David is an unknown quantity at this point
    Join Date
    Dec 2007
    Location
    PA
    Posts
    288

    Re: PHP Issue

    There is something wrong with the file you're including, I'm going to assume that you're not echo-ing anything from that file. If you were including the wrong file, you would be getting an error such as:

    Fatal Error: failed to find file in /path/to/file on line ##

    Or something similar to the above, unless you turned off error reporting (on by default).

    The way the directories are setup, allows you to do full include file paths from the '/', so he, in fact, was correct, which is why there is not something wrong with his include and something is wrong with the included file.
    David Scherer
    Administrator
    David at X10Hosting dot com


  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP Issue

    Quote Originally Posted by ivankoumaev View Post
    I am trying to add a news page to my site using PHP. But the problem is that, even after I add in the coding, the webpage doesn't show up.
    The cause is that files with extension ".html" are not processed by PHP under default settings. If you examine the source of "home.html", you'll see your PHP code. In my opinion, the best solution not involving radical site redesign is to rename the file "home.php", turn on content negotiation by adding "Options +MultiViews" to your root .htaccess and fix any links by removing the file extension. An alternative is to add "AddHandler application/x-httpd-php5 .html .htm" to your root .htaccess, but this will pass every HTML file through PHP, which is inefficient.

    Quote Originally Posted by Livewire View Post
    include's a relative include, which is fine but your path is starting too early.

    Since all of your scripts are already being ran out of /home/ikweb/public_html, drop that whole section from your include and try this:
    If the argument to include() has a leading slash, it's an absolute path where root is the filesystem root. (Only if the web server process has chrooted to the document root will "/cutenews/show_news.php" be the same as "~/public_html/cutenews/show_news.php".) If the path begins with a dot or double dot followed by a slash ("./" or "../"), it's relative to the directory of the including script. Otherwise, PHP searches for the file relative to the entries in include_path and then the current directory. If you want to include a file relative to document root, you can use virtual(), which performs a sub-request to resolve the path as a local URL.

    Edit: I second using "cutenews/show_news.php" as the include path as it will make it easier to set up your site on another host, such as a development server (which I highly recommend).
    Last edited by misson; 05-02-2009 at 01:03 AM.

  9. #9
    cyberbd is offline x10Hosting Member cyberbd is an unknown quantity at this point
    Join Date
    Apr 2009
    Posts
    1

    Re: PHP Issue

    Quote Originally Posted by Livewire View Post
    include's a relative include, which is fine but your path is starting too early.

    Since all of your scripts are already being ran out of /home/ikweb/public_html, drop that whole section from your include and try this:

    Code:
    <?php
    $number=15;
    include("/cutenews/show_news.php");
    ?>
    The key to remember is the include path defaults to where the calling file is in, ergo if index.php is in /home/ikweb/public_html, don't put that in the include - put the rest and it should work fine
    well, instead of that do ->
    Code:
    <?php
    $number=15;
    include("cutenews/show_news.php");
    ?>
    ;)

  10. #10
    ivankoumaev is offline x10Hosting Member ivankoumaev is an unknown quantity at this point
    Join Date
    Apr 2009
    Posts
    4

    Re: PHP Issue

    Renaming it worked! Thank you all so much for helping, you solved the problem!

+ Reply to Thread

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  3. PHP issue with my wordpress theme
    By mrbabyqc in forum Free Hosting
    Replies: 1
    Last Post: 08-30-2008, 01:26 PM
  4. PHP Issue
    By ankurya1985 in forum Free Hosting
    Replies: 1
    Last Post: 03-06-2008, 10:08 AM
  5. Php issue
    By ericwong_kt in forum Free Hosting
    Replies: 1
    Last Post: 08-29-2007, 08:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers