Copied to clipboard

Flag this post as spam?

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


  • Bjørn Fridal 274 posts 784 karma points
    Apr 15, 2010 @ 11:55
    Bjørn Fridal
    2

    How do you handle large numbers of macros?

    Hi,

    I often end up with a rather large amount of macros and I am curious if I handle/implement them the best way. It particularly strikes me when it is the same document type that has a need for a large variety of macros.

    The way I see it there are three methods of including a macro in a page.

    1. Templates: You create a template for each macro. This is fine if you only have a few macros, but if you have many you end with a lot of templates that only contains a macro.
    2. Rich Text Editor: Insert the macro in a Rich Text Editor. I never liked doing this. Especially because I have seen several content editors that just aren't comfortable with it. They end up deleting macros or not using the feature at all.
    3. Macro Picker: Select the macro with the Macro Picker. This is actually quite a good alternative I think, but I have only seen it adopted by few people.

    Any thoughts on the above?

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Apr 15, 2010 @ 12:43
    Lee Kelleher
    1

    Hi Bjørn,

    1. I took this approach when I first started developing with Umbraco.  A few of my customers wanted more functionality, so ended up duplicating templates with the only change being the Macro alias (and properties).

    2. I've never liked this approach. Macros in the RTE just doesn't site right with me - especially when trying to modify the values - just gets messy for me, and my customers always break them.

    3. My favourite approach these days. The last several sites I have built have had minimal templates (usually 3: Master, Content Page and Homepage - in that nested order) ... and then use the excellent MacroPicker to add extra functionality to each Content page. Plus the UI of the MacroPicker makes it difficult for my customers to break it!

    Cheers, Lee.

  • Laurence Gillian 600 posts 1219 karma points
    Apr 15, 2010 @ 12:59
    Laurence Gillian
    1

    1. By templates do you mean MasterPages or do you mean XSLT Templates? On large sites I would refactor macro's down and then allow them to call XSLT templates to make them more flexible.

    2. Agreed, there are some good times to allow editors to insert macro's. But in my experience they are few and far between.

    3. Macro Picker - we sort of use this idea. I'll lay out an example below;

    A website has a section which contains news articles (1 doctype, 1 template), a news article is related to media (a media relation on the doctype).

    The 'new article' document type contains a tab called modules, modules has some UCP's (ultimate content pickers) which list out a folder which contains modules. Editors can picker 'modules' (which are essentially blocks on content) these 'modules' are then passed into a macro which reads the module ID and any content, selects the correct XSLT template and renders out a page. 

    I quickly made a ghastly video showing this, when its a bit quieter in the office I'll record something properly and maybe do some code examples.

  • Laurence Gillian 600 posts 1219 karma points
    Apr 15, 2010 @ 13:02
Please Sign in or register to post replies

Write your reply to:

Draft