Kolusion Posted August 20, 2011 Share Posted August 20, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/245297-include-options/ Share on other sites More sharing options...
trq Posted August 21, 2011 Share Posted August 21, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/245297-include-options/#findComment-1259986 Share on other sites More sharing options...
Kolusion Posted August 21, 2011 Author Share Posted August 21, 2011 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);} Quote Link to comment https://forums.phpfreaks.com/topic/245297-include-options/#findComment-1260041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.