cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Server Side Includes with .irpt pages

Former Member
0 Kudos
171

I am intrested in using server side includes within my .irpt pages for example

<!#INCLUDE FILE="file.inc">

specifically inside of my applet tags to reference a standard set of parameters that I would like to be passed into my display templates. Does xMII have a similar representation of server side includes for .irpt pages?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi, Brett.

Not directly, but do you want to know a hack way to do it?

Alternatively, if you're not using other features of IRPTs, you could simply use JSP pages...

- Rick

Former Member
0 Kudos

Hi Rick,

I would be interested in knowing what the hack is.

I thought about converting to asp or jsp pages but I didn't want to lose some of the other features of IRPT pages.

Former Member
0 Kudos

It might make your head explode, but in a good way...

Also, you'll need 11.5 or newer to run this. There are so incredibly many opportunities that this might open up for you to deliver not only static, but also dynamic embedded server-side content.

There are many aspects of xMII that are largely untapped. A few common ones are the ability of the Runner servlet (which invokes xMII BLS transactions) to stream virtually any type of content back to the requestor (XML, HTML, text, images, PDFs, Excel, whatever).

The other feature that not too many people use is the ability to use an xMII BLS transaction as a "stylesheet".

Lastly, there is the little-known "<SERVLET>" tag that can be used in IRPT pages.

Put all these pieces together, and amazing things can be done. The example I'm going to show you uses a BLS transaction, but it can also be done with an XSL stylesheet (if the desired included HTML is static). But let's go for the cool approach...

Let's assume you have some "stuff", such HTML page content, that you want included in a specific position on your web page. Let's also assume that this "stuff" resides in a file accessible at http://localhost/MyInclude.html (the file extension doesn't really matter).

Create a new BLS transaction with no inputs and an output of type String (the name of the output doesn't matter - but in our case, let's assume you name it HTMLOutput). To workaround a cosmetic bug (which will be fixed in a future patch), you should also create a second output (doesn't matter what name or type) - so add one called "DummyOutput" of type String. Not worth explaining why - just do it.

Next, add either a TextLoader or HTMLLoader action (in the Web group) to your transaction (they both do the same thing, actually - just different icons). In the Output links tab, assign the StringContent of the loader action to the transaction output. This basically accomplishes the loading and streaming of your included "stuff".

Save this transaction. Let's save it in a folder called CoolStuff, with the name IncludeTest.

In your IRPT page, add the following code where you want the "stuff" to appear.

<SERVLET NAME="Illuminator">

<param name="Stylesheet" value="xacute://CoolStuff/IncludeTest" />

<param name="OutputParameter" value="HTMLOutput" />

<param name="Output-Content-Type" value="text/html" />

<param name="Content-Type" value="text/html" />

</SERVLET>

Save the IRPT page, load it, and you're in business!

You can probably already start to envision to possibilities for adding more sophisticated business logic to create "dynamically" embedded content in your IRPT pages...

Best regards,

Rick

Former Member
0 Kudos

I will also show you the "static XSL" way to do it:

<SERVLET NAME="Illuminator">

<param name="Stylesheet" value="http://localhost/IncludedContent.xsl" />

<param name="Content-Type" value="text/html" />

</SERVLET>

Your stylesheet can look something like:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="html" media-type="text/html"/>

<xsl:template match="/">

<xsl:text disable-output-escaping="yes">

<![CDATA[

<script language="JavaScript">

function myFunction() {

alert('Yo');

}

</script>

]]>

</xsl:text>

<span><h1>Table Below</h1></span>

<p/>

<table border="1">

<tr>

<th>Col1</th>

<th>Col2</th>

</tr>

<tr>

<td>Val1</td>

<td>Val2</td>

</tr>

</table>

</xsl:template>

</xsl:stylesheet>

...just replace the HTML with your desired HTML. This approach should also work with 11.0, but I abandoned 11.0 so long ago, I couldn't tell ya...

- Rick