Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott 95 posts 277 karma points
    May 20, 2013 @ 21:02
    Scott
    0

    How to render tinymce or equal in xslt

    Hey everybody,

    I am trying to figure out how I in xslt insert some html that will then eventually render a tinymce or simple editor.

    So what I want is create a form in xslt and in that form have an editor tinymce/simple that then posts back to itself so to say and save a document.

    I have a current form that saves and publishes perfectly but I am not sure how to add the editor to the from in the xslt file.

    Anyone?

    Thanks, Scott

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 21, 2013 @ 08:47
    Chriztian Steinmeier
    0

    Hi Scott,

    There really isn't that much "magic" involved - but you need to know what the HTML to feed the browser should look like. When you have a static HTML page where it works, you're ready to render that with XSLT.

    XSLT just makes it possible to build the HTML dynamically, using bits and pieces from the complete Umbraco solution, e.g. you can create a very simple macro that just renders a <div> tag with an id you've specified somewhere else:

    Create a new XSLT file - choose the "Clean" template and leave the "Create macro" checkbox checked

    Paste this into the editor, replacing everything:

    <?xml version="1.0" encoding="utf-8" ?>
    <xsl:stylesheet
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:umb="urn:umbraco.library"
        exclude-result-prefixes="umb"
    >
    
        <xsl:output method="html" indent="yes" omit-xml-declaration="yes" />
    
        <xsl:param name="currentPage" />
        <xsl:variable name="siteRoot" select="$currentPage/ancestor-or-self::*[@level = 1]" />
    
        <xsl:template match="/">
            <div id="{$siteRoot/@urlName}">
                Check my ID - it should be "<xsl:value-of select="$siteRoot/@urlName" />".
            </div>
        </xsl:template>
    
    </xsl:stylesheet>

    Now add the macro to the template that renders your form - then start putting the tinymce code into the XSLT file and see what happens.

    Come back here with questions that pop up ! 

    /Chriztian

  • Scott 95 posts 277 karma points
    May 21, 2013 @ 12:44
    Scott
    0

    Hi Chriztian,

    I am not sure if I explained myself well enought.

    I am trying to create a form with input field in xslt. I have a form right now see below:

    <textarea name="comment{@id}" style="width: 99%; height: 60px;"><xsl:text>&#x0A;</xsl:text></textarea>
    <br />
    <input type="submit" name="submit" value="Gem" />

    Now instead of the textarea I would like to have a tinymce editor or at least a simple richtexteditor (like this one I am writing in right now)

    Thanks

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    May 21, 2013 @ 12:58
    Chriztian Steinmeier
    100

    Hi Scott,

    As I see it, the solution is still the same — you need to find the docs for whichever editor (TinyMCE, Ace etc.) you choose and find out what you need to render to the browser for it to work, which could be as simple as adding a simple textarea with an ID, which a JAvaScript will then take over upon rendering.

    /Chriztian

  • Scott 95 posts 277 karma points
    May 21, 2013 @ 19:03
    Scott
    0

    Okay, I get it, thanks!

Please Sign in or register to post replies

Write your reply to:

Draft