On May 2, 2006, at 9:24 AM, Keven Ages wrote:

Add the graphic from the XSL rather than the Document. The Document's
HTML is editable by the editors.  The XSL is only editable by
developers.


That's exactly what I'm trying to do but can't find any info on how to
set up the XSLT to pull the proper graphic depending on the page they
are on.

In 1.2, you could have the graphic as an Asset attached to the
Document.  That allows a common name such as "header.gif" to be used
for all Documents.  We use that technique for adding background
graphics: "bg.gif" is used if it exists.  An example Asset would be
in: {pub}/resources/live/about/header.gif

Or have a special directory for "headers" that cannot be edited using
the CMS GUI.
{pub}/headers/about/header.gif
Or for multiple languages:
{pub}/headers/about/header_en.gif


I'd love to see an example of this on the Lenya site.  Anyone?

Here you go.  From our [pub_name]/doctypes.xmap:

     <!-- parametrized doctype matcher -->
      <!-- pattern="{rendertype}/{area}/{doctype}/{document-path}" -->
      <map:match pattern="*/*/*/**.xml">
            <map:generate src="content/{2}/{4}.xml"/>
            <map:transform src="{fallback:xslt/global/{3}2xhtml.xsl}">
              <map:parameter name="rendertype" value="{1}"/>
<map:parameter name="nodeid" value="{page- envelope:document-node-id}"/> <map:parameter name="contextprefix" value="http:// {request-header:host}{page-envelope:context-prefix}"/> <map:parameter name="language" value="{page- envelope:document-language}"/> <map:parameter name="page_name-image-exists" value="{resource-exists:resources/{2}/{page-envelope:document-id}/ page_name.gif}"/> <map:parameter name="banner-image-exists" value="{resource-exists:resources/{2}/{page-envelope:document-id}/ banner.jpg}"/>
            </map:transform>
            <map:transform type="xinclude"/>
        <map:serialize type="xml"/>
      </map:match>

We're passing a "true/false" string parameter for both "banner.jpg" and "page_name.gif" to the XSL stylesheet. If they exist, we use "page_name.gif" for the page title, and "banner.jpg" as the lead image.

The "resource-exists" module is looking in the resource folder of the specific page for specific image names: "resources/{2}/{page- envelope:document-id}/banner.jpg", just like Keven suggested. If it finds it, it returns the string "true" if not, "false".

We pick these up in xhtml2xhtml.xsl with:

<xsl:param name="page_name-image-exists" select="false" />
<xsl:param name="banner-image-exists" select="false" />

The url of the image is constructed thus:

<img border="0">
<xsl:attribute name="src"><xsl:value-of select="$nodeid"/>/ page_name.gif</xsl:attribute>
</img>

Notice we also pass the nodeid as a parameter to the xsl page.

HTH,

-doug


Keven



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Monday, May 01, 2006 5:47 PM
To: [email protected]
Subject: Re: lenya basics

On 5/1/06, Keven Ages <[EMAIL PROTECTED]> wrote:
I'm trying to keep my header graphics out of view of the user in Lenya
when
they are in 'edit' mode.

I'm new to Lenya and XSLT and can't seem to find any info on this on
Lenya's
site or the net.

Basically what I'm trying to do is have the header graphic update
itself
depending on the page it's on (ie, about us header graphic would
appear on
the about us page) w/o the image showing up in edit mode, so that the
user
does not change or mess with it at all.

Any help would be much appreciated - if there is any more info I can
give to
assist - please let me know.

Add the graphic from the XSL rather than the Document.  The Document's
HTML is editable by the editors.  The XSL is only editable by
developers.

In 1.2, you could have the graphic as an Asset attached to the
Document.  That allows a common name such as "header.gif" to be used
for all Documents.  We use that technique for adding background
graphics: "bg.gif" is used if it exists.  An example Asset would be
in:
{pub}/resources/live/about/header.gif

Or have a special directory for "headers" that cannot be edited using
the CMS GUI.
{pub}/headers/about/header.gif
Or for multiple languages:
{pub}/headers/about/header_en.gif

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to