tags:

views:

38

answers:

2

Hi,

I have some code that retrieves the production URL and check some staff.

Im prefer to work in the dev invoroment so I have to write in my code something like this

<?php if(sfConfig::get('sf_environment') == 'dev'): ?>
<?php $url = "http://www.mysite.com/foobar" ?>
<?php else: ?>
<?php $url = $sf_request->getUri() ?>
<?php endif; ?>

Is there any smarter way to operate production URL while im working in dev enviroment? Or do you do this kind of things?

Javi

A: 

You can edit your /etc/hosts file and add an entry for mysite.com that goes to your dev server ip address

Wikipedia article should tell location on windows/mac http://en.wikipedia.org/wiki//etc/hosts#Location_in_the_file_system

(you may have to add one with www.mysite.com also)

cjavapro
+4  A: 

On the projects I work on, I use the app.yml file to take care of things like this.

So in app.yml on dev I have

all:
#  site_url: "http://site.com" #Be sure to change this when you deploy, or write a script to do it
  site_url: "http://site.dev"

And in my code I would have

<?php $url = sfConfig::get('app_site_url'); ?>

I'm not sure if you're looking for something like this

sjobe