Copied to clipboard

Flag this post as spam?

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


  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 22, 2011 @ 10:39
    Matt Brailsford
    0

    Multiple parameters to a base method?

    Hey Lee,

    Nice work on getting shortcodes released.

    Just wondered how you use / pass in multiple parameters to a base method? It wasn't clear in the demo video.

    Cheers

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 22, 2011 @ 10:45
    Lee Kelleher
    0

    Hi Matt,

    Yeah - didn't get around to doing a demo of multiple parameters (due to Screenr's 5 min limitation).

    Multiple parameters in Shortcodes are used liked in /Base ... delimited by slashes:

    [Shortcodes:Max=123/456]

    Depending on feedback, could change this for a future release?

    Cheers, Lee.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 22, 2011 @ 10:52
    Matt Brailsford
    1

    Ok, seems cool.

    Maybe something like this will be more "familiar" to people?

    [Shortcodes:Max(123, 456)]

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 22, 2011 @ 10:57
    Lee Kelleher
    0

    Yeah, I know what you mean... although, my aim was to follow the machine/triple-tag syntax.

    Never say never... I'll give it some thought! :-)

    Cheers, Lee.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 22, 2011 @ 11:11
    Matt Brailsford
    1

    Ah yea, I remember you mentioning that before. I think the only flaw in that, is that most machine/triple-tags seem to be for "holding" a "single" piece of information, where as you are "calling" a method with "multiple" parameters.

    Your call, but I think forcing the syntax down a path it wasn't really meant for might hinder, rather than help.

    Just a thought =)

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 22, 2011 @ 11:17
    Lee Kelleher
    0

    Thanks Matt, full of thoughts today! ;-)

    Good point about the machine-tags... food for thought!

    Cheers, Lee.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 24, 2011 @ 17:53
    Lee Kelleher
    0

    As you know, I absolutely hate to say that you're right ... but, I think you're right about the syntax:

    [Shortcodes:Max(123, 456)]

    Looks similar to XsltExtensions... you know I'll have to integrate that next version too! ;-)

    Cheers, Lee.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 24, 2011 @ 17:59
    Matt Brailsford
    0

    hehe, that must've hurt ;)

    The only other way I could think of doing it would be if you used named parameters instead

    [Shortcodes:Max param1=123 param2=456]

    but I think I'd prefer my first suggestions, plus it's inline with how /base works (doesn't need to know the param names, it's just based on the order)

    Matt

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Mar 24, 2011 @ 18:03
    Lee Kelleher
    0

    Nah, not that painful - well maybe a little! LOL!

    The named parameters is how WordPress handles it, which is good too.  But I agree, the braces syntax falls more inline with .NET methods.

    Cheers, Lee.

  • Andy 10 posts 31 karma points
    Jan 03, 2012 @ 00:41
    Andy
    1

    Thanks for this project! It was a lifesaver! I was trying to get a macro to work inline and it didn't work thanks to the hard-coded way Umbraco handles macros and TinyMCE not letting you put a div inside a p. Then I ran across Morten Bock's excellent article about inline macros, but it said it wouldn't work for macros that take parameters, and it pointed me to ShortCodes.

    I couldn't get it to work at first, then I looked at the example again and realized I was quoting string literals, so in case anyone else has this problem, that may help. For example, use [alias:MethodName(Literal1,Literal2)] instead of [alias:MethodName("Literal1","Literal2")]

    If you've tried to get a macro with parameters to work inline and haven't had any success, hopefully you can get it done with ShortCodes.

Please Sign in or register to post replies

Write your reply to:

Draft