Re: Css generation question
Re: Css generation question
- Subject: Re: Css generation question
- From: Jean-François Veillette <email@hidden>
- Date: Tue, 22 Jun 2004 13:41:43 -0400
I had this exact same problem, I solved it by using a direct action
that return the css.
so in my page header, the url for the .css file was a direct-action url
that returned a wocomponent (stateless) that rendered the correct css.
You already have a component that build your css, you just have to
make it available from a direct action url.
- jfv
Le 04-06-22, ` 13:08, Jerry Porter a icrit :
Hello folks,
The setup:
I have been playing with CSS and I have it working quite well with my
application.
I have a css file stored in a framework in a WebServerResources
directory and use aWOResourceUrl in a component wrapper to return the
url and use it in a link like:
HTML:
<link rel="stylesheet" type="text/css" href="<webobject
name=styleSheet></webobject>">
WOD:
styleSheet: WOResourceURL {
filename = "MyStyleSheet.css";
framework = "MyFramework";
}
Works fine no problems:
Now the problem.
I want to use background images like:
table {
border: 1;
background: #eeeeee;
color: #000000;
padding: 0;
margin: 0"
border: 0;
background-image: url("brushed-aluminum-04.gif");
}
The above image is a resource that is in a WebObjects framework or
application.
The problem is that the location of the image resource cannot be
specified relative to the deployment location of the webobjects
application in the css file, similar to hooking up a WOImage using the
framework binding to divine the location of the resource.
What I did was create a series of components (CssComponent, CssElement)
that reads a plist in a Resources directory. This file represents my
intended css. I add a couple of "hints" in the plist to divine the
location of my resources (with the help or WOResourceManager), it then
generates an inline string that is embed in my pages like:
<html>
<head>
<title>Css Test</title>
<style type="text/css">
table {
border: 1;
background: #eeeeee;
color: #000000;
padding: 0;
margin: 0"
border: 0;
background-image:
url("/cgi-bin/WebObjects/CssTest.woa/wr?
wodata=file:/local/jerryp/Install/Applications/CssTest.woa%
2
FContents/WebServerResources/brushed-aluminum-04.gif");
}
</style>
</head>
<body>
...... Stuff goes here .....
</body>
</html>
This too is ok, except I don't want embed the inline string, I still
want to generate something that I can reference like:
<link rel="stylesheet" type="text/css" href="<webobject
name=styleSheet></webobject>">
The idea is I don't want the css cluttering up my rendered document.
Now the question:
Is there a way I can get a url to my component after it generates the
css and reference it in a link tag?
thanks in advance
Jerry E. Porter
Software Engineer
Wireless Matrix Corporation
102, 1530 - 27th Ave. NE
Calgary, Alberta, Canada
T2E 7S6
Main: 1-403-250-3949
Fax: 1-403-250-8163
email@hidden
http://www.wirelessmatrixcorp.com
_______________________________________________
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.