I want to rename the "web" folder to "html" in symfony 1.4, unfortunately searching for documentation on this has lead me nowhere except for how this would be accomplished in 1.0, which does not seem to be working.
+4
A:
Firstly, you don't have to rename it. You can just create a symbolic link (unless you're running windows):
ln -s web html
If you still want to change the web folder name than you could do it in your project's ProjectConfiguration class by overloading setRootDir():
class ProjectConfiguration extends sfProjectConfiguration
{
public function setRootDir($rootDir)
{
parent::setRootDir($rootDir);
$this->setWebDir($rootDir . DIRECTORY_SEPARATOR . 'html');
}
}
kuba
2010-10-16 07:35:38
kuba, I have given my answer as well, but I don't believe yours will work -- you need the directory separator: `$this->setWebDir($rootDir . '/html');` because symfony doesn't automatically have it.
lonesomeday
2010-10-16 11:22:13
Yes, you're right. Added it.
kuba
2010-10-16 15:33:59
+2
A:
kuba's answer is along the right lines, but I think it is cleaner to use setWebDir
within setup
:
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->setWebDir($this->rootDir . '/html');
}
}
I would generally prefer not to use a symlink, because it clutters up the root folder.
lonesomeday
2010-10-16 11:20:27
Original setRootDir() method in sfProjectConfiguration ALWAYS overwrites the web dir and several other variables. If setRootDir() is called later than setup() (it can be, it's public) than it will change the web dir back to the original value.
kuba
2010-10-16 15:33:22
You're right, my apologies. I noticed that `sf_web_dir` wasn't in the one `sfConfig::add` call and failed to notice that below was a `setWebDir` call!
lonesomeday
2010-10-16 16:10:44