Css Menus

19 views
Skip to first unread message

Dale

unread,
Dec 2, 2011, 11:39:05 AM12/2/11
to Railo
I've been a coldfusion user for severals years and just yesterday
found out about Railo.
I loaded it on a spare server and ported over one of my Coldfusion
Applications. The first thing that I noticed was my css menu's were
not working.

First, the positioning was not correct. Second, the dropdowns were
not functioning.

I tried using info from another post where you use the cfcontent at
the top of the css file and rename the css file to .css.cfm. Still no
change.

Has anyone experience this problem? If so, does anyone have a
suggestion as to a fix?

Todd Rafferty

unread,
Dec 2, 2011, 11:43:44 AM12/2/11
to ra...@googlegroups.com
It's not Railo related. Sounds like you're depending on a virtual mapping that isn't there or something. Railo doesn't care about your CSS file unless you've indeed shoved the entire css file into a .cfm file. 

Show us how you're linking the css file?
--
~Todd Rafferty
Volunteer
Community Manager
Railo Server - Open Source
----

Dale

unread,
Dec 2, 2011, 11:49:30 AM12/2/11
to Railo
Todd,

The css file is in the same virtual directory with the other files.
Here is my link:

<link rel="stylesheet" href="stylegreen.css" type="text/css">

On Dec 2, 8:43 am, Todd Rafferty <t...@getrailo.org> wrote:
> It's not Railo related. Sounds like you're depending on a virtual mapping
> that isn't there or something. Railo doesn't care about your CSS file
> unless you've indeed shoved the entire css file into a .cfm file.
>
> Show us how you're linking the css file?
>
>
>
>
>
> On Fri, Dec 2, 2011 at 11:39 AM, Dale <trivalleybrew...@gmail.com> wrote:
> > I've been a coldfusion user for severals years and just yesterday
> > found out about Railo.
> > I loaded it on a spare server and ported over one of my Coldfusion
> > Applications.  The first thing that I noticed was my css menu's were
> > not working.
>
> > First, the positioning was not correct.  Second, the dropdowns were
> > not functioning.
>
> > I tried using info from another post where you use the cfcontent at
> > the top of the css file and rename the css file to .css.cfm.  Still no
> > change.
>
> > Has anyone experience this problem?  If so, does anyone have a
> > suggestion as to a fix?
>
> --

> ~Todd Rafferty*
> Volunteer** *Community Manager


> Railo Server - Open Source
> ----
> Get Railo:http://getrailo.org/
> Write Documentation:http://wiki.getrailo.org/
> Report Bugs:https://issues.jboss.org/browse/RAILO

> Request Features:https://railo.uservoice.com/- Hide quoted text -
>
> - Show quoted text -

Todd Rafferty

unread,
Dec 2, 2011, 11:52:27 AM12/2/11
to ra...@googlegroups.com
....? So, is this in every local directory that uses that file?

<link rel="stylesheet" href="/stylegreen.css" type="text/css"> <-- stylegreen.css is relative to / (note the slash)

Otherwise, if your file is located in /somedirectory/somefile.cfm, then... stylegreen.css needs to be local to somedirectory as well unless you have a <base href=""> tag implemented somewhere? What are you not telling me? :)
--
~Todd Rafferty
Volunteer
Community Manager

Peter Boughton

unread,
Dec 2, 2011, 11:52:33 AM12/2/11
to ra...@googlegroups.com
What happens when you try and access the CSS file directly yourself?

Do you have a web server involved, and are you using Railo Express or
the Railo installer?

Dale

unread,
Dec 2, 2011, 12:00:22 PM12/2/11
to Railo
Todd,

Here's everything.

I created a virtual directory from root called test.

Within the test directory there is a file called index.cfm.
The contents of which is <cfinclude template="menu.txt"> .

In my application, this is at the top of every page to display the
menu.

Menu.txt consists of the following:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html" charset="utf-8">


<link rel="stylesheet" href="/stylegreen.css" type="text/css">

</head>

<cfquery name="categories" datasource="#request.dns#">
select * from (
select menu.* ,
( select Count(*) from menu as categorySubQuery
where categorySubQuery.lft < menu.lft and categorySubQuery.rgt >
menu.rgt) as depth,
(( menu.rgt - menu.lft - 1) / 2) as descendants FROM menu
order by lft) a
where depth <> 0
</cfquery>


<cfset categoryCount = categories.recordcount>
<body>
<div style="float: right; position:relative; left: -50%;">
<cfoutput><ul id="css3menu" style="position:relative; left: 50%;"></
cfoutput>
<cfloop query="categories">
<cfset dpth = depth[currentrow]>
<cfset dminus1 = dpth - 1>

<cfif categoryCount gt currentrow>
<cfset nextdepth = depth[currentrow+1]>
<cfelse>
<cfset nextdepth = depth[currentrow]>
</cfif>
<cfoutput><cfif rgt[currentrow] - lft[currentrow] gt 1> <li><a
href="#categories.websitefile#">#name[currentrow]#</a><cfelse> <li><a
href="#categories.websitefile#">#name[currentrow]#</a></li></cfif></
cfoutput>
<cfif descendants[currentrow] gt 0>
<cfoutput><ul></cfoutput>
<cfelse>
<cfif nextdepth lt depth[currentrow] >
<cfloop from="#nextdepth#" to="#dpth-1#" index="index">
<cfoutput></ul></li></cfoutput>
</cfloop>
</cfif>
<cfif categorycount eq currentrow>
<cfoutput></ul></cfoutput>
</cfif>
</cfif>
</cfloop>
<cfoutput></ul></cfoutput>
</div>
</body>
</html>

stylesheetgreen.css consists of the following:


ul#css3menu,ul#css3menu ul{
margin:0;list-style:none;padding:0;background-color:#dedede;border-
width:1px;border-style:solid;border-color:#5f5f5f;-moz-border-radius:
5px;-webkit-border-radius:5px;border-radius:5px;}
ul#css3menu ul{
display:none;position:absolute;left:-1px;top:98%;-moz-box-shadow:
3.5px 4px 5px #000000;-webkit-box-shadow:3.5px 4px 5px #000000;box-
shadow:3.5px 4px 5px #000000;padding:0 10px 10px;background-
color:#FFFFFF;border-radius:6px;-moz-border-radius:6px;-webkit-border-
radius:6px;border-color:#d4d4d4;}
ul#css3menu li:hover>*{
display:block;}
ul#css3menu li:hover{
position:relative;}
ul#css3menu ul ul{
position:absolute;left:98%;top:-2px;}
ul#css3menu{
display:block;font-size:0;position:absolute;z-index:1000;}
ul#css3menu li{
display:block;white-space:nowrap;font-size:0;float:left;}
ul#css3menu>li,ul#css3menu li{
margin:0;}
ul#css3menu a:active, ul#css3menu a:focus{
outline-style:none;}
ul#css3menu a{
display:block;vertical-align:middle;text-align:left;text-
decoration:none;font:bold 14px Trebuchet MS,sans-
serif;color:#000000;text-shadow:#FFF 0 0 1px;cursor:pointer;padding:
10px;background-color:#c1c1c1;background-
image:url("mainbk.png");background-position:0 0;border-width:0 0 0
1px;border-style:solid;border-color:#C0C0C0;}
ul#css3menu ul li{
float:none;margin:10px 0 0;}
ul#css3menu ul a{
text-align:left;padding:4px;background-color:#ffffff;background-
image:none;border-width:0;font:14px Tahoma,serif;color:#000;text-
decoration:none;}
ul#css3menu li:hover>a{
background-color:#ccffcc;border-color:#C0C0C0;border-
style:solid;font:bold 14px Trebuchet MS,sans-serif;color:#000000;text-
decoration:none;text-shadow:#fff 0 0 1px;background-
image:url("mainbk.png");background-position:0 100%;}
ul#css3menu img{
border:none;vertical-align:middle;margin-right:20px;width:16px;height:
16px;}
ul#css3menu ul img{
width:16px;height:16px;}
ul#css3menu img.over{
display:none;}
ul#css3menu li:hover > a img.def{
display:none;}
ul#css3menu li:hover > a img.over{
display:inline;}
ul#css3menu span{
display:block;overflow:visible;background-position:right
center;background-repeat:no-repeat;padding-right:0px;}
ul#css3menu ul span{
background-image:url("arrowsub.png");padding-right:28px;}
ul#css3menu ul li:hover>a{
background-color:#ccffcc;background-image:none;font:14px
Tahoma,serif;color:#868686;text-decoration:none;}
ul#css3menu li.topfirst>a{
border-radius:5px 0 0 5px;-moz-border-radius:5px 0 0 5px;-webkit-
border-radius:5px 0 0 5px;}
ul#css3menu li.toplast>a{
border-radius:0 5px 5px 0;-moz-border-radius:0 5px 5px 0;-webkit-
border-radius:0 5px 5px 0;}


All files are in the test directory.


Todd Rafferty

unread,
Dec 2, 2011, 12:03:29 PM12/2/11
to ra...@googlegroups.com
Did you really mean menu.txt?

If you did, what happens when you http://(your host)/test/menu.txt

Does that work?

Dale

unread,
Dec 2, 2011, 12:04:46 PM12/2/11
to Railo
I'm using Railo 3.3.1.000 final on a webserver.

The stylesheet page is stylegreen.css, not stylesheetgreen.css.

Dale

unread,
Dec 2, 2011, 12:09:46 PM12/2/11
to Railo
If you go to http://tvmsbl.info, you can see the menu system running
on my main coldfusion mx 6.1 server. It works perfect there.

Since I was just including this file in every cfm page, I just wanted
to distinguish it from the other pages in my directory. I didn't
think it mattered what the extension was.

If I try to access the menu.txt or the stylegreen.css on my test
server, I get the page cannot be found.

> ~Todd Rafferty*
> Volunteer** *Community Manager


> Railo Server - Open Source
> ----
> Get Railo:http://getrailo.org/
> Write Documentation:http://wiki.getrailo.org/
> Report Bugs:https://issues.jboss.org/browse/RAILO

Peter Boughton

unread,
Dec 2, 2011, 12:13:57 PM12/2/11
to ra...@googlegroups.com
Dale wrote:
> Since I was just including this file in every cfm page, I just wanted
> to distinguish it from the other pages in my directory.  I didn't
> think it mattered what the extension was.

When you cfinclude, extension of the included file doesn't matter.

However, a common way to differentiate files like this is to prefix
with an underscore, or call it "inc_menu.cfm" or similar.

Todd Rafferty

unread,
Dec 2, 2011, 12:14:20 PM12/2/11
to ra...@googlegroups.com
If your file is indeed menu.txt, Railo (or CF 6.1) is not protecting your file. Here's your full source code: http://tvmsbl.info/menu.txt

Not a good thing to reveal.


On Fri, Dec 2, 2011 at 12:09 PM, Dale <trivalle...@gmail.com> wrote:
If you go to http://tvmsbl.info, you can see the menu system running
on my main coldfusion mx 6.1 server.  It works perfect there.

Since I was just including this file in every cfm page, I just wanted
to distinguish it from the other pages in my directory.  I didn't
think it mattered what the extension was.

If I try to access the menu.txt or the stylegreen.css on my test
server, I get the page cannot be found.


--
~Todd Rafferty
Volunteer
Community Manager

Peter Boughton

unread,
Dec 2, 2011, 12:18:54 PM12/2/11
to ra...@googlegroups.com
Dale wrote:
> If I try to access the menu.txt or the stylegreen.css on my test
> server, I get the page cannot be found.

This sounds like the root of the problem - they should be found.

You need to make sure you have the IIS website root directory pointing
to the same location as the Railo webroot.

For HTTP access, Railo only handles *.cfm and *.cfc files (by default)
- so accessing *.css and *.txt in a browser is handled by the web
server (in your case, IIS).

Dale

unread,
Dec 2, 2011, 12:20:49 PM12/2/11
to Railo
When I rename the .css file to .css.cfm, my menu appears. The
position is off and the dropdown movement doesn't work.
If I leave the css file as a .css, only the unordered list format
appears.

Where is the problem with the css. You say it's not Railo. Could it
be tomcat?

Todd Rafferty

unread,
Dec 2, 2011, 12:21:21 PM12/2/11
to ra...@googlegroups.com
Getting back on track with your virtual directory problem, what you didn't explain is if you created this virtual directory in both webserver level and/or Tomcat level. If you didn't, you have to - especially if it's a virtual directory (depending on what you're trying to do). If you're just trying to create a virtual directory for stylesheets, then you only need to create it at the webserver level. 

However, if you're trying to make an entire site inside a virtual directory, then you need to create that virtual directory at the tomcat level as well so that Tomcat is aware that you're trying to process reach those files inside for it to be processed.

Railo doesn't care about the css file and isn't parsing it, if Railo was setup correctly the css file wouldn't have been requested through it at all. The only requests it should care about are cfm, cfc (and, potentially cfml if you're old school).

Peter Boughton

unread,
Dec 2, 2011, 12:23:56 PM12/2/11
to ra...@googlegroups.com
Todd wrote:
> If your file is indeed menu.txt, Railo (or CF 6.1) is not protecting your
> file. Here's your full source code: http://tvmsbl.info/menu.txt
>
> Not a good thing to reveal.

Well it shouldn't matter really - the only case knowing the source
matters is if there are security flaws in it.

But yeah, definitely better to avoid the issue than risk it.

If Dale doesn't want to switch to _menu.cfm (or similar), he can set
permissions in IIS to block that file (can't remember precise details,
but exploring the site, right-clicking on menu.txt and going to
properties is a start).

Dale

unread,
Dec 2, 2011, 12:25:26 PM12/2/11
to Railo
How do you recommend including that file without making the source
code viewable?

On Dec 2, 9:14 am, Todd Rafferty <t...@getrailo.org> wrote:
> If your file is indeed menu.txt, Railo (or CF 6.1) is not protecting your
> file. Here's your full source code:http://tvmsbl.info/menu.txt
>
> Not a good thing to reveal.
>

> On Fri, Dec 2, 2011 at 12:09 PM, Dale <trivalleybrew...@gmail.com> wrote:
> > If you go tohttp://tvmsbl.info, you can see the menu system running


> > on my main coldfusion mx 6.1 server.  It works perfect there.
>
> > Since I was just including this file in every cfm page, I just wanted
> > to distinguish it from the other pages in my directory.  I didn't
> > think it mattered what the extension was.
>
> > If I try to access the menu.txt or the stylegreen.css on my test
> > server, I get the page cannot be found.
>
> --

> ~Todd Rafferty*
> Volunteer** *Community Manager

Dale

unread,
Dec 2, 2011, 12:26:25 PM12/2/11
to Railo
I'll try that,

Thank you for being so patient.

Todd Rafferty

unread,
Dec 2, 2011, 12:28:54 PM12/2/11
to ra...@googlegroups.com

Change the .txt file to a .cfm file so that it has to go through the app server to get it requested or as Peter suggested, tell the webserver to block all *.txt requests.

On Fri, Dec 2, 2011 at 12:25 PM, Dale <trivalle...@gmail.com> wrote:
How do you recommend including that file without making the source
code viewable?

--
~Todd Rafferty
Volunteer
Community Manager

Dale

unread,
Dec 2, 2011, 12:37:22 PM12/2/11
to Railo
I'm want the entire site to be within the virtual directory. How do I
create the virtual directory within tomcat?

Todd Rafferty

unread,
Dec 2, 2011, 12:48:05 PM12/2/11
to ra...@googlegroups.com
I'm assuming you're familiar enough with the server.xml file here, but in your host definition, you'll want to do:
<Context path="/subdir" docBase="{{ correct path here }}"></Context>

Honestly, I'm not sure this is what you want to do, but I have next to no idea of how you've setup your environment to make proper suggestions? Do you really want the entire site in a virtual directory or did you just want it in a sub directory of an existing directory under webroot?

I realize you're just trying to get everything up and running, but there has to be a reason why you're not seeing your css file which isn't being handled by railo or tomcat, it's being handled by your webserver. The moment that you request cfm files and things can't be found, then you've crossed the line because the webserver handed your request off to the app server (tomcat) and then Tomcat decides what to do based on extensions (cfm) and passes it to Railo.
--
~Todd Rafferty
Volunteer
Community Manager

Brad Wood

unread,
Dec 2, 2011, 7:24:31 AM12/2/11
to ra...@googlegroups.com
I know this thread has moved on, but the message below confused me. If the path is "/stylegreen.css" wouldn't that be relative to your web root? The absense of the leading slash would make it relative to the current directory (or any base tag).

Dale, I'm not sure what tools you're using, but an HTTP sniffer like Fiddler or FireBug is pretty much inspensible when it comes to figuring out what's happening with CSS and JS files. It will show you WHERE the browser is looking for them, and if you're getting 404s.

Thanks!

~Brad

Sent from my ASUS Eee Pad
>
> --
> ~Todd Rafferty*
> Volunteer** *Community Manager

> Railo Server - Open Source
> ----
> Get Railo:http://getrailo.org/
> Write Documentation:http://wiki.getrailo.org/
> Report Bugs:https://issues.jboss.org/browse/RAILO
> Request Features:https://railo.uservoice.com/- Hide quoted text -
>
> - Show quoted text -

Todd Rafferty

unread,
Dec 2, 2011, 1:34:12 PM12/2/11
to ra...@googlegroups.com
/ is the root directory on a webserver.

./ is relative.

/stylegreen.css is relative to the root directory.

./stylegreen.css is relative to the directory you're in.

Todd Rafferty

unread,
Dec 2, 2011, 1:45:02 PM12/2/11
to Railo

And, yes, this was my confusion too since omitting the / would make it
relative to the directory that you're in unless there's a <base
href=""> tag somewhere.

Thanks for suggesting Fiddler/Firebug, great idea.

On Dec 2, 7:24 am, Brad Wood <b...@bradwood.com> wrote:
> I know this thread has moved on, but the message below confused me.  If the path is "/stylegreen.css" wouldn't that be relative to your web root?  The absense of the leading slash would make it relative to the current directory (or any base tag).
>
> Dale, I'm not sure what tools you're using, but an HTTP sniffer like Fiddler or FireBug is pretty much inspensible when it comes to figuring out what's happening with CSS and JS files.  It will show you WHERE the browser is looking for them, and if you're getting 404s.
>
> Thanks!
>
> ~Brad
>
> Sent from my ASUS Eee Pad
>
>
>
>
>
>
>
> Todd Rafferty <t...@getrailo.org> wrote:
> >....? So, is this in every local directory that uses that file?
>
> ><link rel="stylesheet" href="/stylegreen.css" type="text/css"> <--

> >stylegreen.css is relative to */* (note the slash)


>
> >Otherwise, if your file is located in /somedirectory/somefile.cfm, then...
> >stylegreen.css needs to be local to somedirectory as well unless you have a
> ><base href=""> tag implemented somewhere? What are you not telling me? :)
>

> >> > Request Features:https://railo.uservoice.com/-Hide quoted text -


>
> >> > - Show quoted text -
>
> >--

Dale

unread,
Dec 2, 2011, 2:20:48 PM12/2/11
to Railo
Todd,

I'm using <link rel="stylesheet" href="./stylegreen.css.cfm"
type="text/css">
to reference my stylesheet from menu.cfm(renamed).

I've enclosed the stylegreen.css.cfm contents within <cfcontent reset
type="text/css"></cfcontent>, so it knows it's css.

I get the menu in menu format. So, it is obviously seeing the css.cfm
file to produce this format and processing some of the css. I'm
assuming it's Railo, since the file is a .cfm .

I have code in tomcat for the context, but not sure that's doing
anything.

Why is some of the css getting processed, but not correctly?

Dale

unread,
Dec 2, 2011, 2:25:29 PM12/2/11
to Railo
Todd,

I got so caught with the css, I just realized the IE version on this
server is 6.0.

When I accessed the page from my client pc, it works fine.

Thank you so much for all your suggestions.

Dale

Todd Rafferty

unread,
Dec 2, 2011, 2:28:46 PM12/2/11
to ra...@googlegroups.com
*shakes fist* damn IE 6! ;)

Glad it works.
--
~Todd Rafferty
Volunteer
Community Manager

Brad Wood

unread,
Dec 2, 2011, 8:33:17 AM12/2/11
to ra...@googlegroups.com
Sorry to back up, but why does your css file end in .cfm? Are you using CFML inside of it to dynamically generate the CSS?

Railo, (or a lack of understanding) is probably playing a role here, but the ultimate symptoms you're describing is that the expected styles are not being applied.
Trust me, you NEED to troubleshoot this from the browser end in my opinion. Install FireBug and verify the following:

1) Are the paths to the style sheets you expect being resoled by the browser an downoaded?
2) Are the contents of the style sheets what you expect. (the CSS files may have ColdFusion errors in them since they are .cfm)
3) Do the DOM elements in the page have the expected styles applied to them (Inspect th element to find out)

Thanks!

~Brad

Sent from my ASUS Eee Pad

Dale <trivalle...@gmail.com> wrote:

>Todd,
>

Brad Wood

unread,
Dec 2, 2011, 8:34:37 AM12/2/11
to ra...@googlegroups.com
lol. That's funny right there. So, can we consider Railo vindicated? :)


~Brad

Sent from my ASUS Eee Pad

Todd Rafferty &lt;to...@getrailo.org&gt; wrote:

*shakes fist* damn IE 6! ;)

Glad it works.

On Fri, Dec 2, 2011 at 2:25 PM, Dale <trivalle...@gmail.com> wrote:
Todd,

I got so caught with the css, I just realized the IE version on this
server is 6.0.

When I accessed the page from my client pc, it works fine.

Thank you so much for all your suggestions.

Dale
Reply all
Reply to author
Forward
0 new messages