Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > How transform words into links? View modes: 
User avatar
Member
Member
Leandro Brito - 11/17/2011 6:51:24 AM
   
How transform words into links?
Hello,

I want implement a funcionality like hotwords, to replace some words into links.

Ex. Suppose a XML file with word and link: "moblie" - "www.mysite.com/mobile.aspx".
The content:

Operator launches new package of services including consultancy, security and mobile device management to help firms adopt more flexible and effective working practices.


The word mobile need be replace to Mobile

Where can I put the code to do this? I think some event Pre_Render on Kentico files.

Thanks!
Best Regards.

Leandro Brito

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/17/2011 7:03:18 AM
   
RE:How transform words into links?
Hello,

The easiest way would be to change the DocumentContent (in the table CMS_Document) of a newly created page during creation. You can go through the content and if a keyword is found, you can wrap it with the additional code. You can use the custom tree node handler for executing your code.

Best regards,
Boris Pocatko

User avatar
Member
Member
Leandro Brito - 11/17/2011 9:43:35 AM
   
RE:How transform words into links?
Thanks for the reply.

There is another way to do this so that when updating the link table the documents do not need to be updated? Any method that I can do an override and change the words.

Best Regards.
Leandro Brito

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 11/21/2011 4:03:38 AM
   
RE:How transform words into links?
Hello,

You could do this on the run, so the document wouldn't be updated. However this approach might cause significant performance issues, since the reevaluating of the code will be done on every request of the document. You would also have to check every time if a new link was added, which causes also some slowing down of the page. My suggestion would be to stick with the first approach. The second approach could be done with some javascript or directly in the web part which displays the given text.

Best regards,
Boris Pocatko

User avatar
Member
Member
Leandro Brito - 11/21/2011 4:53:18 AM
   
RE:How transform words into links?
I'll do the first approach, it seems to be the better choice.

Thank You Boris!