tg.url is required only if you application isn't mounted inside the root
path of the domain.
tg.url('/foo/bar') will lead to http://domain.com/foo/bar If the
application runs in http://domain.com/ and will generate
http://domain.com/somewhere/foo/bar if your application is running in
http://domain.com/somewhere
It is best practice to always use it as it will always make the application
work whenever it is mounted as root or not.
On Thu, Feb 16, 2012 at 7:34 PM, León Domingo <[email protected]> wrote:
> Yes, to be precise it's not a relative URL but I have no problem using
> /foo/bar/
> If i'm developing /foo/bar would take me to http://localhost:8081/foo/bar
> In some production environment would take me to
> http://somedaim.com/foo/bar.
>
> That's why I'm asking the use of tg.url()
>
> León Domingo
>
> Ender - Factoría de Software
> [email protected] <[email protected]>
> Avda. Cerro del Águila, 7. S23 - 2ª Planta
> 28703 S.S. de los Reyes (MADRID)
> Tlf. 902 01 44 01
>
> <http://www.ender.es/>
> <http://www.facebook.com/home.php?#%21/pages/San-Sebastian-de-los-Reyes-Spain/Ender-Factoria-de-Software/142213119143359?ref=ts>
> * <http://www.ender.es>*
>
>
> On 16 February 2012 17:39, Robert Forkel <[email protected]> wrote:
>
>> That's not really a relative url. So it won't work when your app is
>> mounted at a path prefix.
>>
>> Am 16.02.2012 17:34 schrieb "León Domingo" <[email protected]>:
>>
>>> Hi people,
>>> Why should I use tg.url(....) instead of a simply relative-URL?
>>>
>>> Lately, i'm not using it because to me it looks cleaner this:
>>>
>>> $.ajax({
>>> url: "/foo/bar/",
>>> ...
>>> });
>>>
>>> than this
>>>
>>> $.ajax({
>>> url: "{{tg.url('/foo/bar/')}}",
>>> ...
>>> });
>>>
>>> and the result is the same...
>>>
>>> Thanks
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "TurboGears" 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/turbogears?hl=en.
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "TurboGears" 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/turbogears?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" 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/turbogears?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en.