1

I am adding a video component to RTF from CME.

I am performing the following steps:

  1. Click on the RTF and select Insert hyperlink from the ribbon bar after selecting component and browsing for the corresponding multimedia component.
  2. View the source of the RTF. We get:

<a title="Big Buck Bunny" href="tcm:11-1006">Big Buck Bunny</a>

  1. I want to generate the code like:

<a tridion:href="tcm:11-1006" title="Big Buck Bunny">Big Buck Bunny</a>

How can we generate the code as step 3 in CME RTF source?

  • 1
    Why do you want RTF to generate "tridion:href" in the anchor tag? as I don't know exactly what problem you want to solve but the following links can help: link1 and link2 – Saurabh Gangwar Nov 25 '14 at 10:41
  • specific reason – Raj Kumar Nov 25 '14 at 10:43
  • Can you give some more detail on what Templating model you are using and in case you are using Modular Templating, which TBBs are used in your Component Template (and possibly your Page Template too)? – Bart Koopman Nov 25 '14 at 16:36
1

This is (to my knowledge) a change in the product that has happened silently and without warning; rich text fields now contain component links with

<a href="tcm:x-y"></a> 

instead of

<a tridion:href="tcm:x-y"></a>

I've run into this issue myself and the simplest solution is to put a TBB directly in front of this TBB in the compound template chain which rewrites

' href="tcm:x-y"' -> ' tridion:href="tcm:x-y"'

this will ensure backwards compatibility for your existing TBBs.

Note that "older" components can still contain the "old" syntax so do not assume only processing the new syntax solves your problem!

0

I am using DWT and trying to stream the videos using JW player TBB. The code to detect the video component from the rich text box is as follows. Mind this code is generic for the video with-in multimedia files and RTF.

private string InjectVideo(string outputToConvert)
{
    string convertedOutput = outputToConvert;
    string[] outputContainer = new string[] { outputToConvert };

    //look for anchor tags with 'tridion:href'
    string regEx = @"(<a.+?tridion:href[^>]+?(?<x>>).*?\k<x>)";
    Regex TridionHrefExpression = new Regex(regEx, RegexOptions.Multiline | RegexOptions.Compiled);

    foreach (Match matchingElement in TemplateUtilities.GetRegexMatches(outputContainer, TridionHrefExpression))
    {
        string tridionComponentLink = matchingElement.Groups[0].Value;  //gets <a tridion:href="/url">link text</a>

        //Component c = this.GetComponent(); 
        Component c = ExtractComponentFromAnchorTag(tridionComponentLink);
        //only do stuff for video components
        if (IsVideoLink(c))
        {
            //Found a video link.
            //Replace it with Video Div from the parameters schema
            string videoDiv = SetupVideoDiv(c);
            var regex = new Regex(Regex.Escape(tridionComponentLink));
            convertedOutput = regex.Replace(convertedOutput, videoDiv, 1);

            // convertedOutput = convertedOutput.Replace(tridionComponentLink, videoDiv);
        }
    }
}

This code was working fine earlier, per my colleagues. But now the rich text box source has changed somehow.

Though I can change the logic from my TBB to read the new source. But I need to know how the RTF source got changed and revert it back to earlier behavior.

  • 1
    Vinod, What is your question? as you mentioned RTF source has been changed, please mention "the change". – Saurabh Gangwar Dec 26 '14 at 9:51

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.