No announcement yet.

How can I automatically generate hyperlinks in fragment text

  • Filter
  • Time
  • Show
Clear All
new posts

    How can I automatically generate hyperlinks in fragment text

    If you have a lot of hyperlinks to include into a fragment, you will not be able to use the 'Link' feature (in the 'Links' tab) as that only supports a single hyperlink.

    You could use embedded html (!!< and >!!) to include the links, but this method will automatically parse links that begin with 'www' and turn them into hyperlinks.
    - To begin, go to 'Design | Library | Layouts' and expand the 'Fragments' group.

    - Select the layout that you would like to use for this and then right-click on it and select 'Copy'.

    - Rename this new layout to something like 'Auto Link Generator'.

    - Now edit this layout and replace the 'FragmentText' variable with the following code:

    <actinic:block php="true">
    $ftext = <<<ENDFRAG
    <actinic:variable Name="FragmentText" selectable="false" />
    $ftext = str_replace('<br', ' <br', $ftext);
    echo preg_replace('/(www.\S+)/', '<a href="http://$1" target="_blank">$1</a>', $ftext);

    You can now use this 'Auto Link Generator' layout for any fragment where you have lots of 'www' links in the 'Text' field. Select the layout within the 'Layout' tab of the fragment.

    Disclaimer: This code was provided by an SellerDeck user via the SellerDeck Community ( and so can't be supported by the SellerDeck Technical Support team.