views:

29

answers:

2

When moving my project onto a new server, I was required to change the public folder from web to public_html. In addition, I wanted the symfony public files to be in a public folder, public_html/symfony. So they would be accessed by going to the website www.mysite.com/symfony

This was achieved by:

class ProjectConfiguration extends sfProjectConfiguration
{
  public function setup()
    $this->setWebDir($this->getRootDir()."public_html/symfony")

in one of my custom forms, I directly call some images to be displayed using

$this->renderContentTag('image','',array('src' => '/images/'.$object->getImageSrc()))

On my new server it is looking for the images in home/user/public_html/images/image1.gif instead of in the public_html/symfony directory that I thought I specified.

I don't want to have to change my custom form because I want to be able to change the sub folder easily. Why do my images point to public_html instead of public_html/symfony? I clearly misunderstood what setWebDir() does and any insight would be useful.

A: 

I think that renderContentTag() won't recognize src for what it is : it is too general. I think it'll work fine if you use the image_tag() method.

greg0ire
called from inside a widget: image_tag('/images/'.$object->get..worked, thanks!
+1  A: 

If you want the src value for an image use the helper:

image_path('/images/'.$object->getImageSrc());
johnwards