How to filter field content in Dreamweaver template creation block

I am working on Dreamweaver TBB in SDL Tridion 2011.

Say my component has a "aaa" field with this content.

"hi hello <bbb name='abcd_efgh_ijkl'>MRJJJJ</bbb> how are you"

      

I want to write DWT TBB in such a way that I produce output as

"hi hello MRJJJJ how are you".

      

So, I want to highlight some of the content in the field (here the field name is aaa) when I render for display purposes.

I'm new to this and stuck here.

+3


source to share


4 answers


You can extract the value of this field and put it in your templating package using either C # snippet or TBB assembly in Microsoft .NET. Then you can manipulate the value with C # and output the changed value with DWT using @@ NameOfModifiedValueInPackage @@. Other suggestions for sources of features or other type of intermediary are equally valid. However, most projects require some kind of .NET TBB anyway, so this shouldn't be a lot of extra work.



+1


source


In DWT TBB in Tridion, you should normally only fetch values ​​from a Component. Handling these values ​​is not what you would do in DWT.

If you need this kind of handling, take a look at the custom IFunctionSource implementation. With this, you could write something like this in your DWT:

@@StripXhtml("aaa")@@

      



So, you implement your own StripXhtml function in the IFunctionSource class.

For a great example of such a feature source, take a look at Nuno Dreamweaver Get Extension over SDL Tridion World.

If you really intend to combine HTML and process in a single TBB, you may need to use a templating language that better supports the combination. XSLT Mediator and Razor Mediator are good examples of these types of templates.

+4


source


Looks like a ResolveXHTML issue.

Are you using TBB "Final Finish Actions" as the last TBB in your composite template? This contains the ResolveXHTML function that transforms the content of the Tridion RTF field and removes the namespaces.

0


source


I wonder if you really understand what you are trying to do.

Looking at the sample you are using here it looks like you are trying to replace some text with a dynamic variable - like the username. However, if you do this in a Dreamweaver template, it will be executed at publish time, not when the page is displayed to a visitor on your website, resulting in the same value being displayed to every site visitor.

0


source







All Articles