Jump to content

Auto Generate Multiple Includes


mgarant

Recommended Posts

Hello all,

 

I'm a brand new user of this forum, and made a little search about my problem before posting, but couldn't find any straight-forward answer to my question... So here i am!

 

What I'm trying to do is to include all my php files dynamically.... (I do the same for JS and CSS files and it is working great) Let me explain...

 

I run a php script that start from the root of the web site and iterate through all the folder and subfolders and returns all the files contained in the web site directory. Everything is working fine for that. What i don't know how to do is generate all my php includes from that script. For the JS and CSS it is quite easy... juste generate a big string containing the all <script> tags... same goes for CSS... but for php, I have no idea how I could transfer my includes from the script to the page calling the script. Here is a code sample

 

<?php
  include("path/class.websitehelper.php");
  $Websitehelper = new Websitehelper();
  $includes = $Websitehelper->GenerateIncludes();

  //To use/plug the JS scripts
  echo $includes['JS'];
  //To use/plug the CSS
  echo $includes['CSS'];

//How do i plug the php includes?????
?>

 

 

Anyone have any idea?

 

Thanks a lot!

Link to comment
Share on other sites

Thanks for the quick reply taquitosensei !

 

That is what i am actually doing, but it can be a real pain in the ass to do this when you have like 100 php files... And when you add one, or change the name of one file... it is a pain as well to change it... That is why I want to generate these includes dynamically by iterating through all the files in the website directory...

 

Any other ideas on how I could achieve this?

 

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.