rxs_navbase not parsing when publishing

I’ve defined the variable rxs_navbase for both Preview and Publish (actually, for Site Folders Assembly) but it isn’t parsing in my HTML page, though I think I’ve used it properly in the template. Any idea why, when I publish, I’m getting the literal

<link rel="stylesheet" href="${rxs_navbase}/css/rxs_styles.css" type="text/css" />

instead of

<link rel="stylesheet" href="/My_Home/resources/css/rxs_styles.css" type="text/css" />

?

Michael,

Did you use parentheses in your code as in your posting? That won’t work.

Also, did you define the binding variable in the Template as well? See “Adding a Context Variable to the Global Template” on p. 175 of the Rhythmyx Implementation Guide.

RLJII

(PS: Gig 'em! :smiley: )

Michael,

It’s been pointed out to me that I misread your code, which uses curly braces rather than parentheses. This usage of curly braces is valid Velocity. (Parens are not.)

My apologies for that error.

RLJII

Thanks, Robert. But under the Bindings tab of my Global Template, I have now added a Variable Name “$sys.variables” with the Value(JEXL Expression) “$sys.variables.rxs_navbase” and I get the same results.

	<link rel="stylesheet" href="${rxs_navbase}/basic.css" type="text/css" media="screen" />

	<link rel="stylesheet" href="$rxs_navbase/marcomm.css" type="text/css" media="screen"  /> 
	<link rel="stylesheet" href="${$sys.variables.rxs_navbase}/print.css" type="text/css" media="print" />

Michael,

Have you refreshed Content Explorer? These values are usually cached, and refreshing Content Explorer updates them.

RLJII

Yes, the same thing happened after I refreshed Content Explorer, refreshed the browser, logged in and out, reloaded Java, and even after I restarted the Rhythymx server.

Michael,

Would you mind posting the code from your Template?

RLJII

Here’s the head. The base href helps make the stylesheets work while I develop. I’m using the line with ‘href="${rxs_navbase}/print.css"’ to test this problem.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<base href="http://156.92.165.15:9992/My_Home/" />
		<title>#displayfield("displaytitle")
		</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="includes/basic.css" type="text/css" media="screen" />
		<link rel="stylesheet" href="includes/marcomm.css" type="text/css" media="screen"  /> 
		<link rel="stylesheet" href="${rxs_navbase}/print.css" type="text/css" media="print" />
		<link rel="shortcut icon" href="images/favicon.ico" />
		<meta name="keywords" content="#displayfield('keywords')" />
		<meta name="description" content="#displayfield('description')" />
		<meta name="DC.Title" content="#displayfield('displaytitle')" />
		<meta name="DC.Subject.Keyword" content="#displayfield('keywords')" />
		<meta name="DC.Description" content="#displayfield('description')" />
		<meta content="Percussion Rhythmyx" name="generator"/>
	</head>

Michael,

You said in Item 4 below that you named your Binding Variable “$sys.variables”, but the Binding Variable you are calling in your code is “rxs_navbase”. Change the name of the Binding Variable to $rxs_navbase to match the call in your Template code. That should take care of your problem.

You could do the reverse as well (change the call in the Template to match the name of your Binding Variable). I recommend that you not do so as it would be contrary to best practice. Percussion reserves the “$sys” prefix for system usage.

RLJII

If velocity can’t find the referenced variable, it just outputs the text. Therefore, if you are seeing something like ${myvariable} in your output, it means that it isn’t defined (as far as Velocity is concerned.)

Typically for this case, you should have a variable whose name is $rxs_navbase and whose value is $sys.variables.rxs_navbase (it is basically a shorthand to save typing in the template.) It wasn’t clear from the preceeding posts whether you had this exact entry or not.

Yes, that fixed it. Thanks. I misunderstood that documentation on page 175.