Directory / File Indexing - Structure Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Gaines

    Directory / File Indexing - Structure Question

    As part of learning php I have set up an automated directory/file listing
    process.

    On my server I have a directory called 'Notes' and under that a dozen or
    so dub-directories on various topics, each containing a mix of html and
    mht files.

    In the Notes directory I have a php script which echoes links to each sub
    directory (excluding . and ..) and incorporates a link to a file
    'index.php' in each sub directory.

    In turn index.php echoes the html/mht files along with a link to them.

    This means that I can add/remove directories and files and they will
    automatically be included in my browser, as long as I remember to copy
    index.php to each new directory.

    I want to change this slightly so that clicking on a link in Notes.php
    will write a file called index.html to the selected sub directory and then
    navigate to it. This avoids having to copy index.php to each sub directory.

    I am OK with most of it except how to switch to the index.html file from a
    php file. I read a comment somewhere that php is not html so doesn't
    recognise links so is there a way to switch to a specified file in a
    browser from a php script please? Having re-read this I need a process
    that can call a function then activate a link to index.html in the
    appropriate directory.

    Many thanks.

    --
    Jeff Gaines Damerham Hampshire UK
    There are 10 types of people in the world, those who do binary and those
    who don't.
  • Captain Paralytic

    #2
    Re: Directory / File Indexing - Structure Question

    On 15 Oct, 13:07, "Jeff Gaines" <jgaines_new... @yahoo.co.ukwro te:
    As part of learning php I have set up an automated directory/file listing
    process.
    >
    On my server I have a directory called 'Notes' and under that a dozen or
    so dub-directories on various topics, each containing a mix of html and
    mht files.
    >
    In the Notes directory I have a php script which echoes links to each sub
    directory (excluding . and ..) and incorporates a link to a file
    'index.php' in each sub directory.
    >
    In turn index.php echoes the html/mht files along with a link to them.
    >
    This means that I can add/remove directories and files and they will
    automatically be included in my browser, as long as I remember to copy
    index.php to each new directory.
    >
    I want to change this slightly so that clicking on a link in Notes.php
    will write a file called index.html to the selected sub directory and then
    navigate to it. This avoids having to copy index.php to each sub directory.
    >
    I am OK with most of it except how to switch to the index.html file from a
    php file. I read a comment somewhere that php is not html so doesn't
    recognise links so is there a way to switch to a specified file in a
    browser from a php script please? Having re-read this I need a process
    that can call a function then activate a link to index.html in the
    appropriate directory.
    >
    Many thanks.
    >
    --
    Jeff Gaines Damerham Hampshire UK
    There are 10 types of people in the world, those who do binary and those
    who don't.
    I think you are looking for the header() function

    Comment

    • Jeff Gaines

      #3
      Re: Directory / File Indexing - Structure Question

      On 15/10/2007 in message <ff079b02q4p@dr n.newsguy.comTo m wrote:
      >I think most PHP is setup on teh web server so all .php files are parsed
      >by PHP.
      >IF the file extension is .html then it would be a plain HTML file that us
      >sent
      >as-is. If you didn't need any PHP code in the index pages you are creating
      >in
      >those directories, it would make sense to simply use the .html version .
      Many thanks Captain P and Tom, I will investigate the header() function.

      In the meantime I have taken a slightly different approach. I have
      book-marked CreateIndexFile s.php as my entry point to my notes files. The
      script then creates an index.html file in each sub-directory and echoes a
      link to each of those index files. This means if I add/delete a directory
      or file then I just navigate to the bookmark, hit Ctrl+F5 and it gets
      re-built automagically.

      If anybody has any other suggestions as to how to achieve this I would be
      happy to try them as part of my learning process :-)

      --
      Jeff Gaines Damerham Hampshire UK
      There are 3 types of people in this world. Those who can count, and those
      who can't.

      Comment

      Working...