Jump to content

include() options?


Kolusion

Recommended Posts

I am new to PHP and wasting no time have jumped into creating my own database system. Its actually a psuedo-database, but who cares it works. I've done something some-what similar in Python but with a static single file database.

 

What I have is directories as like:

./1/index.listing

./2/index.listing

./3/index.listing

 

The numbers are a product... product 1, product 2, you know..

What I want to do is on the product category page, using:

include('./*/index.listing');

.. where * would mean for PHP to scan all relative directories and include 'index.listing', which will result in a list being built for the product category, showing all the available products.

There is probably some way to do this in MySQL, but I am already familiur with this style of database, so why waste more Saturday nights learning something I don't have to when I could be out getting drunk and partying with girls 10 years younger than me. LuLz

Link to comment
Share on other sites

You could use glob to build an array of files to include then loop through that array including them.

 

There is probably some way to do this in MySQL, but I am already familiur with this style of database, so why waste more Saturday nights learning something I don't have to when I could be out getting drunk and partying with girls 10 years younger than me

 

Because in the end, it's a better design that is more efficient and easier to implement.

Link to comment
Share on other sites

A very good suggestion! That sound like a part of the engine I am looking for, but how would I specify which directory to search, and to specify the search to be reclusive, then to include all of those files? Can it be done?

 

I'll tried this, but it failed:

 

foreach (glob("*.lodb") as $filename {
                                                include($filename);}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.