473,411 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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.
Oct 15 '07 #1
2 2475
On 15 Oct, 13:07, "Jeff Gaines" <jgaines_new...@yahoo.co.ukwrote:
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

Oct 15 '07 #2
On 15/10/2007 in message <ff*********@drn.newsguy.comTom 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.
Oct 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: FISH | last post by:
Ever have one of those days when you're not sure if it's you who's gone mad, or the rest of the world? I have an Open Source project on SourceForge for communication with YSMG - Yahoo's IM...
4
by: shane | last post by:
From searching around, Ive seen this question asked numerous times, but havent seen a usable answer unfortuantly. What Im trying to do is something I would have thought would be quite common,...
1
by: soni29 | last post by:
when creating a project with namespace like: wrox.csharp.basics.overflowtest is it good practice to have the directory structure like that also: c:\wrox\csharp\basics\overflowtext.cs Also if it...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
4
by: Elmo Watson | last post by:
Is there a way, with the System.IO class, to do a recursive list of a directory structure? For instance, in DirectoryInfo, you have GetDirectories and GetFiles .... In Directory, you have...
6
by: dave | last post by:
I really have 2 questions regarding the following xml snippet. The xml is a directory representation. <?xml version="1.0" standalone="yes"?> <FileSystem> <Row> <ID>1</ID> <Name>Root</Name>...
2
by: Danny Boy | last post by:
Hi, "Snif" is an excellent little script to index files and directories. It's just one single file, and the advantage is that you merely drop it into the directory you want to index, point a...
7
by: Ryan | last post by:
I have a bit of a problem with regards an indexing strategy. Well, basically there is no indexing strategy on a set of data I have at work. Now, I didn't create the design as I would have allowed...
2
by: Peted | last post by:
Hi i have a circumstance where a user unzips a file, with a certain layer of directories to get to a textfile. So in any directory on the HDD they may end up with something like ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.