3

We are using Site.com to create community pages. These pages will be edited by contributors. There will be one page for each product. I want to use a template which contains text. Can the text include a placeholder/variable for the product name, such that the contributor can just simply type in the product name once and it replaces the placeholder in all places in the template? I know this can be done using merge fields with Data Repeaters/Data Elements, but we are not planning to do it that way.

Thx, Hamayoun

2

It is not possible to do it without Data Repeaters. There is no syntax for referencing arbitrary variables in an expression. There are some context variables (e.g., CurrentUser) with communities.

If you are passing the value (e.g., productName) in as an URL parameter and absolutely cannot use a Data Repeater you could always use a custom code block with JavaScript to get the URL parameter value and replace various portions of the DOM with that value. This isn't all that great of a solution and you'd have to be careful to guard against malicious users trying to inject something bad. I'd avoid this one.

One of the issues that I've seen for wanting something like you do is to not have to expose the ID value(s) in the URL (it's icky). If your model is that every product has its own Page that is created from the same Page Template and the Page Template has the Data Repeater, and you do not want to expose the ID, then you could use an alias redirect (they are server side) to 'hide' the ID from the end user and keep a more user/search friendly URL.

For example, given two pages that extend the same page template:

 /products/widget1 redirects to /products/widget1?id=0000000789879XUAZb
 /products/widget2 redirects to /products/widget2?id=00000007897898UZXb 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.