Copied to clipboard

Flag this post as spam?

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


  • miguel 9 posts 29 karma points
    Mar 07, 2011 @ 04:40
    miguel
    0

    same language different content on some pages based on querystring

    Hello everyone.

    I'm new to umbraco and after doing a some reasearch I still dont know how to tackle this problem.  Here is my problem, most of my site has the same content but on some particular pages based on the "county" selected the content has to change.

    I was thinking of creating a document type withe 2 textBody fields, like textBody_county1, textBody_count2 and then create a macro that would see if textBody_count2 was empty then just default to textBody_county1 othwerwise display the content for textBody_county2.

    any suggestions on how I can get this accomplished?

    Thank you.

  • Sascha Wolter 615 posts 1101 karma points
    Mar 07, 2011 @ 07:02
    Sascha Wolter
    0

    Hi Miguel,

    your approach sounds quite reasonable. To accomplish this I'd do the following:

    - whenever a (multi-language) field needs to be displayed on the site you can't use the umbracoItem but need to use Xslt, etc.

    - create a global function (e.g. a Xslt template in a global Xslt file that gets included in every other Xslt file where you will need the functionality), which takes the name of the field you want to display, e.g. 'bodyText', and the language identifier, e.g. 'country1' or even better '_es'. The Xslt (or whatever macro solution you prefer) will then get the value of the field, e.g. <xsl:value-of select="$page/*[name() = concat($fieldName, $country)]" />

    - the global function can then also handle the default mechanism, e.g. if the value is empty for the field with the given country id you can set up a default country id which will then be used to return the value of the field.

    Hope that was what you were looking for, let us know if not or if you need more info. :)

    Sascha

  • miguel 9 posts 29 karma points
    Mar 07, 2011 @ 14:59
    miguel
    0

    Thanks Sascha,

    I'll give this a try and report back :)

     

Please Sign in or register to post replies

Write your reply to:

Draft