Copied to clipboard

Flag this post as spam?

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


  • Sherry Ann Hernandez 320 posts 344 karma points
    Apr 30, 2011 @ 10:07
    Sherry Ann Hernandez
    0

    using cache in a usercontrol

    Hi,

    I try to set the macro cache of one of my usercontrol to 600 seconds. But when I refresh the page the usercontrol didn't display anything. If I use in in my xslt macro, it works fine.

    Is it not possible to use it [macro cache] in usercontrol?

     

    Sherry

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 30, 2011 @ 10:46
    Kim Andersen
    0

    Hi Shery

    Yes, it should be perfectly fine to set macro caching on you usercontrol macros as well as you xslt macros. I can't quite understand why it doesn't work.

    Have you seen the free video on umbraco.tv about macro caching, maybe this can help you out a bit? If not you can find id here.

    /Kim A

  • Sherry Ann Hernandez 320 posts 344 karma points
    Apr 30, 2011 @ 12:45
    Sherry Ann Hernandez
    0

    Hi Kim,

    I already follow it. But it seems the parameter caching is not working. I'm always getting a empty xslt.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 30, 2011 @ 14:56
    Kim Andersen
    0

    Ahh okay, then it's weird. Does the usercontrol require any parameters of any kind to work or so?

    /Kim A

  • Sherry Ann Hernandez 320 posts 344 karma points
    Apr 30, 2011 @ 16:08
    Sherry Ann Hernandez
    0

    The xslt macro cache is also not working because when I try to use the dropdown, the xslt always returns empty. The xslt requires a querystring which is like this:

    <xsl:variable name="source" select="umbraco.library:RequestQueryString('hotelID')"/>
    <xsl:variable name="mode" select="umbraco.library:RequestQueryString('mode')"/>

    This xslt filters and display's the different restaurant in our hotel. Base on the value of the variable I will display the list of restaurant.

    The problem is I try to add a macro parameter in my xslt and change the above code to

    <xsl:variable name="source" select="/macro/hotelID"/>
    <xsl:variable name="mode" select="/macro/mode"/>

    But still I get an empty result in my xslt.

  • Kim Andersen 1447 posts 2196 karma points MVP
    Apr 30, 2011 @ 19:54
    Kim Andersen
    0

    Have you declared the two parameters on the macro in the back office?

    If you do this, you should be able to chach on parameter-level which I think is the best solution in your situation. You can still grab the parameter values from the url in your first example. Then if you want to cach the macro on parameter level you can insert the macro like this:

    <umbraco:Macro ID="Macro1" Alias="yourMacroAlias" hotelId="[@hotelId]" mode="[@mode]" runat="server"></umbraco:Macro>

     

    The above piece of code will make sure that you are caching the macro depending on the two parameters in your URL. Does this make any sense? And does it help?

    /Kim A

Please Sign in or register to post replies

Write your reply to:

Draft