Copied to clipboard

Flag this post as spam?

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


  • Matthew Vines 11 posts 31 karma points
    Aug 24, 2010 @ 13:49
    Matthew Vines
    0

    How does one assign a macro as a type of a field in a Doc Type?

    Refers to: How to add an image wrapped in a link to the image so that end users may select the image.

    I am attempting to make it possible for a user to fill in a link and image by selecting an image from media in his content tab for the page.

    I have the following macro:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
       
    version="1.0"
       
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
       
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
       
    xmlns:umbraco.library="urn:umbraco.library"
       
    exclude-result-prefixes="msxml umbraco.library">

     
    <xsl:output method="xml" omit-xml-declaration="yes"/>

     
    <xsl:param name="currentPage"/>
     
    <xsl:param name="galleryName" />
     
     
    <xsl:template match="/">
       
    <xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/imageAlias, 0)" />
       
    <a ref="{$galleryName}" href="{$media/umbracoFile}">
         
    <img src="{$media/umbracoFile}" alt="{$media/altText}" />
       
    </a>
     
    </xsl:template>
    </xsl:stylesheet>

    How do I get this macro into my document type so that I can fill it out on the content tab for the pages?

    I understand how macros work with templates, but I will not be allowing the user access to the templates section to fill out macros there, and the template is used in more than one place, so the content on each one has to be different, and I shouldn't have to have 2 templates to do that.

    Should this be a Data Type instead of a Macro?  What are the steps in creating a data type if that is what is required here?

    Thanks for your time,

  • daniel_sbbs 33 posts 52 karma points
    Aug 24, 2010 @ 14:06
    daniel_sbbs
    0

    Put an Editor in the content tab and insert the macro from there.

  • Matthew Vines 11 posts 31 karma points
    Aug 24, 2010 @ 14:11
    Matthew Vines
    0

    Thanks Daniel

    That's interesting.  And not at all how I thought this would work.  I was thinking I could define the layout of my gallery in a template, and then use that template on several pages, just asking the user for 10 images.

    But what this means, is that I either have to define my entire gallery as a macro, or have my user learn how to embed the macro in the correct places in the content.  Is this how this sort of thing is normally done?

Please Sign in or register to post replies

Write your reply to:

Draft