4

The problem I have is the following. I have a component template with "Allow on Page using Dynamic Assembly" enabled. The component that is going to be rendered by this CT has a component link.

So when I publish the page, the dynamic component template, and the components the result that I get is that the component link is not resolved so I don't get link.

This is the code I'm trying with the web user control:

private void CreateResults(int index)
{
    ComponentPresentationAssembler cpa = new ComponentPresentationAssembler();
    litResult.Text = string.Empty;

    for (int i = 0; i < Results.Count; i++)
    {
        string content = cpa.GetContent(Results[i], TemplateUri);
        if (content != null
            && (System.Text.RegularExpressions.Regex.IsMatch(content, ".*CountryCode:" + CountryCode + ".*",
                System.Text.RegularExpressions.RegexOptions.IgnoreCase)
            || System.Text.RegularExpressions.Regex.IsMatch(content, ".*CountryCode: .*")))
        {
            litResult.Text += content;
            break;
        }
    }
}

And this is the code inside the CT:

<div class="ContactPerson">
    <!-- CountryCode:@@Component.Country@@ -->
    <h3 class="Title_Widget">Contact Person</h3>
    <div class="info_Block">
        <img class="Author_Image" src="@@Component.Picture@@"/>
        <div class="contact_Block">
            <p class="Author_Name">@@Component.Name@@</p>
            <!-- TemplateBeginIf cond=" StringLength(Fields.LinkLinkedinProfile) > 0 " -->
                <p class="Author_Linkedink"><a href="@@Component.LinkLinkedinProfile@@" taget="_blank"><span class="linkedinImage"></span></a></p>
            <!-- TemplateEndIf -->
        </div>
    </div>
    <!-- TemplateBeginIf cond=" StringLength(Fields.PhoneNumber) > 0 " -->
        <p class="Author_Phone">T @@Component.PhoneNumber@@</p>
    <!-- TemplateEndIf -->
    <p class="Author_Email">M <a tridion:href="@@Component.ContactForm@@">@@Component.EmailAddress@@</a></p>
</div>

Could someone help me?

Thanks in advance.

3
  • 1
    Did you check that the corresponding entry in web.config for the Content Delivery DLL is there in your web solution containing the above user control Commented Nov 13, 2013 at 11:53
  • Yes, I have checked the web.config and I have register the user control. In fact the web user control is working, because I get all the content rendered by CT but without the componentlink resolved.
    – ITB
    Commented Nov 13, 2013 at 11:56
  • You should definitely check out @Harald's advice. This sounds like a typical dynamic linking issue when the content published is static (XML, Text) instead of dynamic content. Commented Nov 14, 2013 at 12:23

4 Answers 4

9

You mention this
"Also if I put ASP code in the CT this ASP code is showed in the page as text."

If you want to have asp code (i assume you mean asp.net code) and link resolving (which also uses an asp net server control) in a dynamic component presentation, then you should make sure to publish this dcp as an ascx control, not just as a html text fragment. You should also make sure your storage config puts ascx component presentations in the filesystem, not in database.

3
  • Thanks for your help Harald. Finally I solved the problem. Do not if in the best way. What I did was to change the ouput of the CT to ASP VBScript as you told me, then I printed the tcm (componentlink) I needed in the CT so in the Web User Control y get the tcm by Regex and then I resolve the component link with the class componentLink.GetLink().Url and finally I replace the tcm by the url. Don't know if it is the best way but it works.
    – ITB
    Commented Nov 14, 2013 at 15:07
  • 2
    if it works, great, but i'm not sure if this is the cleanest solution. Is your main website using asp or asp.net ? if it's asp.net, then you should publish your dcp to an ascx control, than you wouldn't to do anything extra, it would work out of the box. Commented Nov 14, 2013 at 15:51
  • +1 Harald for the very important term 'out of the box'. @user2354829 think about future maintainability of moving away from out of the box. Commented Nov 17, 2013 at 10:09
7

The link in pankaj's answer does have some great points, if that doesn't resolve it, I'd recommend adding the following information to your question:

  • The DWT code where you perform the HREF to your component link
  • Confirm the link you wish to link to is published
  • The language you are using to publish the content asp, rel, etc
  • An overview of your CD application
  • Paste the log files here from your linking application

Good luck!

1
  • Nice list. +1 to the link needing to published, specifically as a component presentation (dynamic or statically embedded) on a Tridion page that's also published. Oh and the TBBs that resolve links (default finish actions or otherwise), we'd be looking for the tcdl or tridion link syntax. Commented Nov 13, 2013 at 18:47
4

You may want to go through this question and various suggestion made in this:

Why-are-component-links-not-showing-up-on-my-staging-web-site

3
  • I had a look to this question but I get the rest of the components link resolved, so my problem is only when I try to resolve a component link throw a dynamic publishing. Also if I put ASP code in the CT this ASP conde is shoed in the page as text.
    – ITB
    Commented Nov 13, 2013 at 12:00
  • 1
    Is your page extension .html?
    – Nuno Linhares
    Commented Nov 13, 2013 at 12:31
  • No, my page is an .aspx page
    – ITB
    Commented Nov 13, 2013 at 14:43
3

Are you using Component Template output format as "HTML?" Could you please try "REL" as output format of your CT and see the result. I hope it should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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