Directory / File Indexing - Structure Question

This is a discussion on Directory / File Indexing - Structure Question within the PHP Language forums, part of the PHP Programming Forums category; As part of learning php I have set up an automated directory/file listing process. On my server I have ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-15-2007
Jeff Gaines
 
Posts: n/a
Default 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.
Reply With Quote
  #2 (permalink)  
Old 10-15-2007
Captain Paralytic
 
Posts: n/a
Default Re: Directory / File Indexing - Structure Question

On 15 Oct, 13:07, "Jeff Gaines" <jgaines_new...@yahoo.co.uk> wrote:
> 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

Reply With Quote
  #3 (permalink)  
Old 10-15-2007
Jeff Gaines
 
Posts: n/a
Default Re: Directory / File Indexing - Structure Question

On 15/10/2007 in message <ff079b02q4p@drn.newsguy.com> Tom 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 CreateIndexFiles.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.
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:26 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0