Lukas Kahwe Smith wrote:
> Lukas Kahwe Smith wrote:
> 
>> The development case when I do not bother to setup a vhost. I am sure 
>> there is a cleaner/better solution. Ideas?
> 
> Something that will probably work much better would be to be able to 
> change the relative url used in the AssetHelper. As a matter of fact I 
> only had to change the _compute_public_path() method accordingly. Seems 
> like a slightly cleaner solution.

I just added the following to our internal wiki. I do not claim that it 
will win a beauty contest .. maybe it should become a standard feature 
in symfony to prevent the newbie mistake of deploying with a development 
frontend controller in place?

In order to prevent end users from accessing development front 
controllers or other administrative tools, these files should be moved 
to a directory "admin" inside the root symfony directory. This will 
however break any assets from loading properly. The solution is to 
change the AssetHelper? to use a different relative url in that case. 
The following steps are necessary for this:

1) Add a constant in the given front controllers that points to a script 
that makes the necessary adjustments:

define('SF_REWRITE_ASSET_HOST', dirname(__FILE__).'/fix_server.php');


2) Add the script in the defined location:

$dirname = 'admin';

// production case
if (strpos($sf_relative_url_root, $dirname.'.')) {
   $sf_relative_url_root = str_replace($dirname.'.', '', 
$sf_relative_url_root);
// developer case
} else {
   $sf_relative_url_root = $sf_relative_url_root.'/../web';
}


3) Overwrite the AssetHelper? by putting it into the application helper 
library directory with the following change made to the 
"$sf_relative_url_root" variable inside the "_compute_public_path" function:

$sf_relative_url_root = $request->getRelativeUrlRoot();
if (defined('SF_REWRITE_ASSET_HOST')) {
   require SF_REWRITE_ASSET_HOST;
}


This solution is still quite hacky, but until a better idea comes along, 
it seems like the best solution to not have to remove these files 
entirely before going to production.

regards,
Lukas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to