Including server-side code


We’re using Rhythmyx to manage the content for our ASP driven sites.

How do we include our ASP server-side code so that it is published to our production web servers but not rendered as text when working within Rhythmyx.



Rhythmyx Rookie

This thread might help you:

Only partially.

Code that would be replicated on many pages would be distributed via a server side include. However there would be a certain amount of code that would need to be directly in the body of the page.

Not sure if this is what you’re looking for but we came across a situation where we did not want analytics code and some php to be displayed when previewed within RX.

So what we’ve done in our template is to check to see if the parameter (sys_itemfilter) is public. This apparently works and the code block is only printed on publishing.

There may be a better way to check for it, but this is what we came up with:

## code you want only rendered on public here

Thanks jitendra, that’s exactly what I’m looking for.

I had just been looking through the variables and was just about to try something similar using sys_context != 0 instead.

But if your way works, I’ll use that instead.

Yeah, good point on the sys_context…I’m not sure why I didn’t use that, but i’m sure there was a good reason for it…I wouldn’t entirely discount ignorance :D, but I think I came across a situation where that didn’t work as expected so i went the sys_itemfilter route…

I’m sure the percussionistas here would be more than happy to clarify…

sys_context is the “right way” to do this, because it controls what “location” the items are published to, so it will always be correct when publishing.

However, some systems have more than one publishing context, so the best way to test on context is to check for sys_context == 0 || sys_context == null.


So basically having a sys_context == 0 || sys_context == null means that you are previewing the page?

So just checking to see if (sys_context != null && sys_context != 0) should be enough to target some code that would only show up on publish?

Okay, what if you have code that you want to be parsed then displayed in Preview? Is that possible? Is that what Dave was talking about in the other thread I cited?

If you wanted the code to be parsed on preview then you probably wouldn’t want to do any of the checking (as you would not necessarily care if it were preview or publish as in both cases, you’ll have to render the code…)

Of course you’re talking about dynamic content (asp / php code) that probably won’t render (actually work) on preview without some great effort (which is part of the thread that you cited)