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
https://forums.phpfreaks.com/topic/245297-include-options/
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
https://forums.phpfreaks.com/topic/245297-include-options/#findComment-1259986
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
https://forums.phpfreaks.com/topic/245297-include-options/#findComment-1260041
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.