Re: dynamic css
Re: dynamic css
- Subject: Re: dynamic css
- From: Sam Barnum <email@hidden>
- Date: Wed, 28 Jul 2004 09:00:06 -0700
The cleanest way to do this would be to just reference the images
statically, since the browser looks for any files referenced in the CSS
file RELATIVE TO THE CSS FILE, not relative to the page being viewed.
So if your css file is in WebServerResources, chances are your
background image is too, and you can just use:
div.bung {
background-image: url('myImage.png');
}
The big caveat to this is, it won't work in direct connect. For
whatever bizarre reason, WO intercepts the calls for the image, and
routes the request to the /cgi-bin/WebObjects directory. In deployment
mode (non-direct-connect), all the image requests are going directly to
apache, so it will work just fine. Much cleaner than having a
dynamically generated css file.
That said, if you do decide to go the dynamic css route, set the
content-type header to text/css
On Jul 28, 2004, at 8:39 AM, Greg Kick wrote:
I meant in the project as part of the web server resources. But,
Jerry Porter's cssmangler is almost exactly what i was trying to
accomplish and does it a lot cleaner than i was doing. Thanks for
pointing me in the right direction.
Greg
On Jul 28, 2004, at 6:56 AM, Michael Engelhart wrote:
I'm not sure what you mean by the image being "part of the
application" and used in a stylesheet. Is it an image that's stored
in the database or on the filesystem?
Mike
On Jul 28, 2004, at 1:33 AM, Greg Kick wrote:
I've been trying to figure out how to deal with CSS in WO for a
while.
The problem I was having was that I have an image that I want to be
part of the application but also want to be referenced in the
stylesheet for use as a background. What I ended up doing was
creating
a component that ends up being the stylesheet by making it a partial
document to eliminate the html. I then use strings to fill in the
dynamic parts using the following method:
public String logoURL()
{
WOContext aContext = context();
WOResourceManager rm = application().resourceManager();
return rm.urlForResourceNamed( "logo.gif",
"app",
aContext.session().languages(),
aContext.request() );
}
I then use a WOGenericElement to insert the link tag and have the
href
point to a direct action that returns the css component.
It works, but seems like it's probably the most ridiculous way to do
it
ever. Anybody have any ideas on how to clean it up? Thanks.
Greg
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.