Loading a file into a DIV

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Loading a file into a DIV

    Hi. I want to be able to load some content from a text file straight into a
    DIV. Here's the code.

    <p class="mainTxt">

    <?php
    $page = $_SERVER['QUERY_STRING'];
    $path = "mystoryfiles/";
    $content = file_get_contents($path.$page.'.txt');
    echo $content;
    ?>

    Basically, I have a series of files that are accessed via links,
    [url]www.somesite.com/somepage.php?content[/url], for example. But, given the filename
    content.txt in the directory mystoryfiles, this doesn't seem to work... what
    am I doing wrong? Thanks in advance.

    Ziggi


    Ziggi Guest

  2. Similar Questions and Discussions

    1. Loading PDF file
      :confused; I've done what Contribute tells me to do about loading a PDF file from my computer. I get the file into the edit box but there is a...
    2. How to clean file cache before loading PDF file ?
      Hi, I have one application in which we open PDF file inside it using the following api . BOOL ok = m_pAcroAVDoc->OpenInWindowEx (pszPathName,...
    3. loading variables from exe file
      i want load some variables from external exe file. my exe generate some variables but i cant load them into flash. have an idea ?
    4. error loading non-utf-8 XML file
      I'm trying to create a rss-reader, which will be used on a dedicated platform. I've got everything up and running, except for one. I need to...
    5. loading swf file into another one
      Hi, What scripts do I use to load a Flash file into another Flash file. Thanks. H
  3. #2

    Default Re: Loading a file into a DIV

    "Ziggi" <one_ziggi@hotmail.com> wrote in message
    news:<bkihke$kn6$1@pegasus.csx.cam.ac.uk>...
    >
    > I want to be able to load some content from a text file straight into a
    > DIV. Here's the code.
    >
    > <p class="mainTxt">
    >
    > <?php
    > $page = $_SERVER['QUERY_STRING'];
    > $path = "mystoryfiles/";
    > $content = file_get_contents($path.$page.'.txt');
    > echo $content;
    > ?>
    >
    > Basically, I have a series of files that are accessed via links,
    > [url]www.somesite.com/somepage.php?content[/url], for example. But, given
    > the filename content.txt in the directory mystoryfiles, this
    > doesn't seem to work... what am I doing wrong?
    Try this:

    $page = $_SERVER['QUERY_STRING'];
    $path = './mystoryfiles/';
    readfile ($path.$page.'.txt');

    Obviously, I am assuming /mystoryfiles is a subdirectory of the
    current directory. Is this a correct assumption?

    Cheers,
    NC
    Nikolai Chuvakhin Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139