Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Request: Separated entry script #146

Open
MichaelSchmidle opened this issue Jan 7, 2011 · 4 comments
Open

Request: Separated entry script #146

MichaelSchmidle opened this issue Jan 7, 2011 · 4 comments

Comments

@MichaelSchmidle
Copy link

Hi Turbine development team,

first of all many thanks for such a great time saver that Turbine is! I only recently started using this great tool but already I cannot imagine going back stupidly writing CSS... =)

However, I have already one "feature" request: Please arrange the files and directories in the Turbine distribution in such a manner that the main code easily can be placed outside the webroot. With the current stable version 1.0.11 this is not possible without hacking lib/base.php.

I imagine the following arrangement of files and folders (only first level shown) in the default distribution:

/
|- Turbine-1.0.11
'- css.php
  • The distribution consists of A) an entry script that servers as bootstrap and B) a folder containing all the files with the actual Turbine code (see example above).
  • The entry script can be placed somewhere in a directory that is accessible via the web. The folder with the Turbine library however can be placed somewhere else outside the webroot (see example below).

After unpacking the distribution and placing the Turbine library outside the webroot the directory structure might look as follows:

/
|- libraries
|  |- Turbine-1.0.11
|  |  |- cache
|  |  |- lib
|  |  |- ...
|  |  '- turbine.php
|- ...
'- webroot
   |- css
   |  '- css.php    <= accessible via web; includes '../../libraries/Turbine-1.0.11/turbine.php'
   |- ...
   '- index.html

(Such an entry script of course could hold the configuration array, too—maybe even an array of files to process as alternative to passing a string of semicolon separated file names (css.php?file1.css;file2.cssp)—making it a breeze to use Turbine in different websites with different configurations and upgrading the core software without loosing any dirty hacks in the process.)

In any event you would (only) need to adapt the way the configuration is read in lib/base.php (line 65). Just unzipping the distribution and putting it in its entirety in a web accessible directory of course would sill work.

I hope you like my "feature" request and consider adapting the code.

Thanks for reading, keep up the great work!

Cheers,
Mellou

@SirPepe
Copy link
Contributor

SirPepe commented Jan 8, 2011

That's a good idea and I already hacked something up: https://github.com/SirPepe/Turbine/commit/3bc785d4871163cf6571fae4b06241a6027228ab

Copy css.php and config.php to webroot, set the path to the Turbine installation in the turbine_dir variable in config.php and it mostly works. There is one problem however... Turbines "core" contains some files that must be accessible via web - for instance the HTC files that take care of some bugs in Internet Explorer. I don't really know what to do about these cases at the moment.

@MichaelSchmidle
Copy link
Author

Sorry for double posting after accidentally hitting the delete button instead of the edit button (stubby fingers on iPad ;-)) of my previous comment... Here it comes again:

Thanks for your prompt reaction! I'll check it out.

If there are files that need to be accessible via web other than the entry script and there is no way of serving these through the entry script as well (i.e. with the help of get_file_contents() or similar), then separating 'core scripts' and 'web files' would be perfectly fine too of course.

/
|- turbine-core    <= holds the Turbine's main library
'- css    <= holds the files that need to be accessible via web
   |- turbine-web    <= holds the files that cannot be served indirectly through css.php
   '- css.php    <= Turbine's entry script

Anyway, placing as much of Turbine outside the webroot as possible should easily be possible. Thanks for looking into it!

@SirPepe
Copy link
Contributor

SirPepe commented Jan 11, 2011

We'll figure something out and make this a feature for version 1.2.

@MichaelSchmidle
Copy link
Author

Good stuff, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants