473,786 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2500
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

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

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

Similar topics

9
5339
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 protocol. I keep the project source in three directories, based upon the code's function: one for the network API code itself, one for the support APIs (basic chat spam filtering, Swing models, rich text decoders, etc), and one for the test client...
4
9245
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, but there just seems to be no information on the topic that I can find. Basically I need to store a directory structure in memory, from a flat list of files and paths. ie given: C:\dir\dir1\abc.txt C:\dir\toop.txt
1
5091
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 is then is there a way to make visual studio set it up for me as i'm creating the cs files? or do i have to first create the directory structures and then as i save files save them in the correct places depending on the namespace i create.
60
49196
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 be indexed/sorted. I don't want to load the entire file into physical memory, memory-mapped files are ok (and preferred). Speed/performance is a requirement -- the target is to locate the string in 10 seconds or less for a 100 MB file. The...
4
3712
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 Directory.GetFileSystemEntries(path), but I would like to know how to put this together, knowing which entry is a Subdirectory and which entry is a file, and make a recursive list of the Directory structure below a specific path - - -
6
1741
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> <Directory>Root</Directory> <Dir>true</Dir>
2
2515
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 browser to the script and you're done. But to me, the simplicity is a DISadvantage since I need to index directories that are located down in the site hierarcy, and to which the users won't have direct access.
7
1820
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 for this. OK, so there is primary key (clustered) indexes (mainly composite keys), but no other indexes on the tables. As you would expect, the performance leaves a lot to be desired. A hell of a lot. We have several million rows in a lot of the...
2
4311
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 dir1/dir2/dir3/dir4/dir5/file.txt
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10169
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.