Results 1 to 5 of 5

Thread: file_get_contents, geshi

  1. #1
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default file_get_contents, geshi

    this:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Patrick Allard</title>
    </head>
    <body>
    <p>html working</p>
    <?
    include_once 'geshi.php'; 
    $file = file_get_contents('/samples/actionscript/firebutton.as', FILE_USE_INCLUDE_PATH); 
    echo $file;
    $language = 'actionscript 3';
    $geshi = new GeSHi($file, $language);
    echo $geshi->parse_code();
    ?>
    </body>
    </html>
    is producing this:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Patrick Allard</title>
    </head>
    
    <body>
    <p>html working</p>
    <pre class="actionscript3" style="font-family:monospace;">&nbsp;</pre>
    </body>
    </html>
    it should have at least echoed the file back, even if im not doing the geshi class correctly, but i am pretty sure i am. i know the directory of firebutton.as is correct, and im pretty sure i put everything that geshi needs where it should be. i unpacked it so that geshi.php is in the same directory as my script, along with the folders it came with. if you want to check my directorys go here:
    http://patiscool.000space.com/pats%2...tionscript.php
    i have directory listings enabled so u can go up a directory and check.

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    What code does http://patiscool.000space.com/pats%2...v1.4/geshi.php have? It looks like theres an error in there.
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    GeSHi

    is this line
    Code:
    <pre class="actionscript3" style="font-family:monospace;">&nbsp;</pre>
    the geshi output? What's in firebutton.as?

    Edit:

    nevermind, I found firebutton.as. You have all the code on a single line, which begins with a comment. So basically, the file outputs nothing.

    I'm not sure why php wouldn't echo out the contents though. and I'm not familiar with GeSHi, so I'm not sure exactly how it's supposed to behave.

    it's in the same directory as your page though, have you tried simply
    PHP Code:
    <?php

    $file 
    file_get_contents('firebutton.as');
    echo 
    $file;

    ?>
    Depending on your server, the filename might be the problem, too. Your directory listing shows FireButton.as , which is not the same (on most systems) as firebutton.as .

    Last edited by traq; 04-17-2010 at 03:02 AM.

  4. #4
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    i thought i fixed that before i posted. i made sure it was fixed but still couldnt get it to work untill i used file_get_constants without a directory, so i guess i wont organize the samples into folders. i am certain that the directory was correct though, this will bug me for a long time

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    you were using the FILE_USE_INCLUDE_PATH flag, so unless your server's include path is the same as your site root (unlikely), then you weren't pointing at the right place.

    If the root-relative path you used was correct, then just remove the flag:
    PHP Code:
    $file file_get_contents('/samples/actionscript/firebutton.as'); 
    and it will point where you expect it to

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
  •