Copied to clipboard

Flag this post as spam?

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


  • Simon Osborne 108 posts 150 karma points
    Oct 14, 2010 @ 12:36
    Simon Osborne
    0

    How to make Macro parameters easy to edit by end user

    Hi,

    very much a neewbie question, but I am totally sold on Umbraco as a development environment but I need to ensure that the editing of the site is as easy as possible for our clients.

    I have created an Image Hyperlink macro that has two parameters, a url parameter supplied by a nodepicker and a media parameter supplied by a mediapicker.

    All works fine when I insert the macro into the template, I get to choose the values through the two picker controls and the hyperlink image displays fine.

    But on an ongoing basis how does my clicent easily change the image or url for this hyperlink?

    Do I create a generic parameter and pass that into the macro, if so what is the point of specifying the Macro parameter type of media/node picker if its only used once (when the macro is inserted). I can't see my client being comfortable going into the template Html to editing or remove/add the macro again.

    Is there a way of making it editable though the Canvas interface?

    Thanks in advance...

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 14, 2010 @ 13:49
    Tom Fulton
    0

    Probably the best way is to add the two picker fields to your doctype, and let the user edit them from there.  Then you can adjust the template to read in the parameters from the values the user specified on the page rather than hardcoding them.  You can do this with placeholders

    <umbraco:Macro pUrl="[#yourUrlFieldName]" pMedia="[#yourMediaFieldName]" Alias=......

    You can also do recursive fields using $ instead of # - more info here:  http://umbraco.org/documentation/books/macro-parameters-syntax/advanced-parameter-syntax

     

  • Simon Osborne 108 posts 150 karma points
    Oct 14, 2010 @ 14:02
    Simon Osborne
    0

    Thanks Tom,

    I'd added some doctype pickers before but couldn't get the syntax correct on how to pass them in - simple when you know how ;)

    Can editing these values be done also through Canvas editing?

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 14, 2010 @ 16:27
    Tom Fulton
    0

    Not too sure about Canvas, I don't use it much :)  But I don't think it allows editing macros.

    Hopefully someone else can chime in...

Please Sign in or register to post replies

Write your reply to:

Draft