Linkcollection pagetitle as clickable text

Vote:
 

Hi,

I have a question about the linkcollection property. I want the 'Clickable text' of each link to be the corresponding Page Title. So when a page title changes, i don't have to change the Clickable Text in my linkcollections.

Also, when the language is changed in our website, we want the titles in the linkcollection to change to the titles of the referred pages in the new language. This can be achieved by making the linkcollection unique per language, but then the entire linkcollection has to be defined in each language. I want the items to be the same in each language, only translated to the chosen language.

It would be nice in the Links in a LinkCollection to have the option 'Clickable text = referred pagetitle' (only possible on referred pages in the same website).

That is the best way to achive my goal?

Thanks!

#53571
Sep 15, 2011 10:36
Vote:
 

Just point to an EPiServer page instead of external page and you'll be fine.

Frederik

 

#53573
Sep 15, 2011 11:49
Vote:
 

Unfortunately not. When pointing to an EPiServer page, the title of the page is automatically filled in in the Link. However, this value is filled in as a fixed value. So when changing the title of the referred page afterwards, the link is not renamed. It still links correctly, but the tekst on the link is the old title.

Also when changing language, the link works correct (links to the page in the new language), but the tekst on the link is the fixed value of the old language.

I've tried to fix it in code-behind, but the LinkItems don't seem to have any properties which lead to the PageData of the referred page. So i don't know how i can find the title of the referred page.

#53579
Sep 15, 2011 13:13
Vote:
 

you can use this

PermanentLinkUtility.FindPageReference(guid)

you have the guid of the page in the LinkItem.Href property

 

#53581
Edited, Sep 15, 2011 14:36
Vote:
 

Hi Jasper

If you use an EPiServer Property control for rendering the LinkItemCollection it should take care of everything for you.

<EPiServer:Property runat="server" PropertyName="MyLinkItemCollection" />

    

You can also convert the LinkItemCollection to a PageDataCollection: http://www.frederikvig.com/2009/06/episerver-extension-methods-part-2/ and http://www.frederikvig.com/2009/05/episerver-link-collection/

 

Hope this helps

Frederik

#53582
Sep 15, 2011 14:41
Vote:
 

Thank you, both solutions work. Getting the guid from the LinkItem.Href is a bit dirty, though.

I now convert the LinkCollection to a PageDataCollection as mentioned, then the EPiServerProperty takes care of the renaming. Just binding the LinkCollection to the property does NOT.

Jasper

#53586
Sep 15, 2011 15:29
Vote:
 

What do you mean by: "Just binding the LinkCollection to the property does NOT."?

Frederik

#53588
Sep 15, 2011 15:31
Vote:
 

I mean that when i bind the LinkCollection to a property, the original problem emerges. This is the scenario:

1) I have a page with 2 languages. The titles are 'Contact Pagina' (Dutch version) and 'Contact Page' (English version) 

2) On the homepage, i have a pageproperty of type LinkCollection, it is called 'RelatedLinks'. It is not unique per language, since the links i want to show are the same for all languages.

3) In the Dutch view of the homepage, i fill RelatedLinks with one Link, a reference to the internal EPiServer page with title 'Contact Pagina'. I leave the Clickable Text empty. The Clickable Text is filled in automatically with the referred when saving the Link.

4) I put a EPiserver:Property on my home.aspx page, this property references RelatedLinks.

5a) When i view the homepage in Dutch, i see the Link to 'Contact Pagina' (Dutch), when clicking this link, i am redirected to the 'Contact Pagina' (Dutch version). This is what i want.

5b) When i view the homepage in English, i see the Link to 'Contact Pagina' (Dutch), when clicking this link, i am redirected to the 'Contact Page' (English version). This is not what i want. I want an English link here.

I don't want to make the link collection Unique per Language, because it is a lot of work to manage the links for all languages. The link collection is the same for all languages, i only want their Clickable texts translated to the current language of the website.

But converting them to a PageCollection, as you suggested earlier, and binding an EPiServer property to this PageCollection does the work. It shows the titles of the referred pages in my property. So when changing to English, the English page titles are shown.

Thanks!

Jasper

#53625
Sep 16, 2011 9:42
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.