I would like to split the email address across two separate lines, ie left of the @ and right of the @inclusive, i am using Dreamweaver templates. (Tridion Version 2009), Thank you
Jamie has included some great suggestions. All of which I recommend over this one, but most people don't realize that there is limited string manipiulation possible using JScript functions (i.e. substring and indexOf) within DWT TBBs. So this is possible:
Of course you can use a field value instead of the whole string, but this shows the point. I think this is pretty ugly, and would really suggest creating a Function Source, but in a pinch, this would work for you.
Depending on what the use case is, there are several approaches, for example, do you want to apply this behaviour to all the email addresses in the output? is it in a specific situation?
If it is the first case (apply to all email addresses) you can achieve that by implementing a C# TBB that "finds" all the email addresses (with a regular expression for example) and replace them with the "splitted" version of them.
If it is for a specific "field", you could pass the field name as a parameter using a parameter schema in the very same TBB and only replace the email address that matches the field you passed by as a parameter.
Yet another option would be to implement a Dreamweaver Function something like '
SplitEmailAddress(email)' that will do the job for you. Then you should be able to do something like
However you need to take into account what is a "new line" for you. It could be a \n or \r or a html 'br' element, etc...