W liście writeson z dnia czwartek 07 stycznia 2010:
> Hi all,
>
> I'm a pretty new user of Pylons and I've got a question about using
> jQuery/jQueryUI with Pylons. When I'm developing on my local machine
> and accessing static files in the public directory things work fine.
> But when I post this to our production server there is a problem
> accessing images that are embedded in jQuery and jQuery css files
> (background-mage : url(/images/thing.png);). This is because my local
> development path is something like this:
>
> /tool/verify
>
> where as in production:
>
> /plant/tool/verify
With CSS files it's probably best to reference all images with relative paths.
They are resolved using CSS file location as base, so you don't have to worry
about which page is including the CSS file.
So with structure like
(something)/css/myfile.css
(something)/images/myimage.png
I'd use background-image: url('../images/myimage.png')
With regard to javascript, I'd inject path to project root to some global
variable.
In your top-level layout template, in the <head> (before all other scripts)
you could put this snippet
<script>
var MyProjectConfiguration = {
'base_path' : ${h.url('/')}
}
</script>
Then in other scripts you can construct paths with code like
MyProjectConfiguration.base_path + 'some/path' (important: no leading slash)
--
Paweł Stradomski
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.