|Number of votes:||1|
Someone posted something to the forums in which they’re solving a problem I’ve had in the past using Dynamic Content:
[we used] DynamicContent property to display a site wide value on the web page.
So, Dynamic Content is used as a placeholder, essentially, which gets swapped with some value at render time. We’ve run into this several times.
We started using Dynamic Content for this, but we found it was a little heavy-handed. Our clients wanted something simple and fast. Additionally, you can’t see what value you are replacing from the editor. You just see the generic “Page Property” placeholder, but you have no idea which property you are dumping there. Finally, in the second situation, the editor couldn’t pick the specific page from which to pull the property for the Page Property plugin – they just wanted the property from the current Start Page, whatever that happened to be for this particular site.
So, we decided to go the wiki-like route and just have the client embed a text pattern which we would catch and replace at render time. Something like this:
We mapped these to properties on the Start Page. So, at render time ”[[CustomerServicePhone]]” gets replaced with the contents of the “CustomerServicePhone” property on the Start Page. (We use Start Page properties all the time to hold site-wide values, since there will only ever be one Start Page.)
The code to execute this is in a PageAdapter mapped to System.Web.UI.Page, like this:
<adapter controlType="System.Web.UI.Page" adapterType="BlendInteractive.PageAdapters.TokenReplacer" />
By doing this as a Page Adapter rather than on the Property control, we catch this token everywhere it’s used, whether it’s coming out of a Property control, is hard-coded into the template, is written to the browser from code-behind, whatever.
This has worked well for us on the two projects where we’ve used it. A few things to know: