On Thu, Oct 8, 2009 at 07:30, sebastian <[email protected]> wrote:
>
> Hi All,
>
> I am using a JS library (http://jquery.com/demo/thickbox/) which refer
> to "images/something.jpg". That works perfectly on static HTML but
> web2py translates it as "http://blabla/init/default/images/
> something.jpg".
>
> as work around I'd like to create a controller names images that
> returns the image in static/images. I'm sure that it would be 2 lines
> of web2py... any ideas ?
Yes, it happens with nicEdit[1] too. You have 3 ways to solve this problem:
1- Change routes.py to redirect "/yourapp/default/images/blablabla" to
"/yourapp/static/images/blablabla" (you may change routes_in and
routes_out, see routes.example.py). This way the 'redirect' will be
'internally' - user won't get any redirect.
2- Create a function called images in default.py and redirects user to
/static/images/request.args, something like that:
def images():
redirect(URL(r=request, c='static', f='images/' + '/'.join(request.args)))
I don't like this second way since user will be redirected in all requests.
3- Change JS code to point to "/yourapp/static/images/" instead of "images/"
I prefer 3rd option. :-)
[1] http://www.nicedit.com/
--
Álvaro Justen
Peta5 - Telecomunicações e Software Livre
21 3021-6001 / 9898-0141
http://www.peta5.com.br/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---