sivaprasad9394
Occasional Collector

How to get the absolute url using CMS_REF in FS5

Jump to solution

Hello,

How to get the absolute url for the image?

                         $CMS_SET(extMediaLink)$$CMS_REF(content.external_link,abs:2)$$CMS_END_SET$

                             <!-- extMediaLink1: $CMS_VALUE(extMediaLink)$ -->

                        $CMS_SET(extMediaLink1)$$CMS_VALUE(content.external_link)$$CMS_END_SET$

                             <!-- extMediaLink2: $CMS_VALUE(extMediaLink1)$ -->

Output:

<!-- extMediaLink1: -->

    <!-- extMediaLink2: ../../../../media/testdaten/technics-q-c-720-540-6.jpg -->

I would like to form the url like,

$CMS_SET(standaloneLink)$$CMS_VALUE(ps_standaloneHost,default:"")$$CMS_END_SET$ (contextpath)

Final result should be like,

http://www.data.com/media/testdaten/technics-q-c-720-540-6.jpg

How to form like this?

Thanks,

Siva

0 Kudos
1 Solution

Accepted Solutions

Hello Mr. Peter Jodeleit,

Thanks for you kind reply,mistake is on my side.....

I have fount out the problem,

CMS_INPUT_LINK name="csExternalTeaserLink" it is mapped to the database column "external_link".

to get the value of selected ref: external link teplate name "lt_downloadref" need to be used.There i did mistake.Now working fine.

OLD Code:

<atom:link rel="detail" href="$CMS_VALUE(contextPage)$$CMS_REF(content.external_link,abs:2)$"/>

New Code :

<atom:link rel="detail" href="$CMS_VALUE(contextPage)$$CMS_REF(content.external_link.lt_downloadref,abs:2)$"/>

Thanks,

Siva

View solution in original post

0 Kudos
9 Replies
Peter_Jodeleit
Crownpeak employee

Please render the value of your $CMS_REF directly. And please always check your log!

Additional tip: If you need to pass internal urls as parameter use the function ref. Check the documentation for usage.

Peter
0 Kudos

Hello Peter Jodeleit,

I have tried that also,but nothing renders in screen,

<atom:link rel="detail" type="text/html"

    href="http://data.com........EMPTY" />


<atom:link rel="detail" type="text/html" href="$CMS_VALUE(standaloneLink)$$CMS_REF(content.external_link,abs:2)$"/>

The out is looks like,

http://data.com .............

CMS_REF returning empty  value...

Thanks,

Siva

0 Kudos

Sorry, I can't reproduce this.

Peter
0 Kudos

Hello Mr. Peter Jodeleit,

Thanks for your kind reply...

Still i am facing the absolute path in FS5.

To diffferentate portal page or standalone page,

$CMS_SET(contextPage, "")$

        $CMS_IF(setIsPortal)$

            $-- determine, if page is in portal context --$

            $CMS_SET(contextPage)$$CMS_VALUE(psProjectUri,default:"")$$CMS_END_SET$

        $CMS_ELSE$

            $-- determine, if page is in standalone --$

            $CMS_SET(contextPage)$$CMS_VALUE(ps_standaloneHost,default:"")$$CMS_END_SET$

        $CMS_END_IF$

For Link Template,

$CMS_IF("lt_overlaylink_internal".equals(ltSelectedName.toString()))$

                     $--This condition belongs to internal link--$

                     <atom:link rel="detail"  href="$CMS_TRIM(level:4)$$CMS_VALUE(contextPage)$$CMS_REF(content.external_link,abs:2)$$CMS_END_TRIM$"/>   

$CMS_ELSIF("lt_overlaylink_media".equals(ltSelectedName.toString()))$

                     $--This condition belongs to media link--$

                     $CMS_SET(link, "")$

                     $CMS_SET(extMediaLink)$$CMS_VALUE(content.external_link,default:"")$$CMS_END_SET$

                     $CMS_IF(isSet(ss_portal_integration) && ss_portal_integration.equals("true"))$                       

                        $CMS_SET(portalLink)$$CMS_VALUE(psBNNProjectUri,default:"")$$CMS_END_SET$                                               

                        $CMS_SET(link)$$CMS_VALUE(portalLink)$$CMS_VALUE(extMediaLink)$$CMS_END_SET$                       

                    $CMS_ELSE$                       

                        $CMS_SET(standaloneLink)$$CMS_VALUE(ps_standaloneHost,default:"")$$CMS_END_SET$                                                               

                        $CMS_SET(link)$$CMS_VALUE(standaloneLink)$$CMS_VALUE(extMediaLink)$$CMS_END_SET$           

                    $CMS_END_IF$

                     <atom:link rel="detail" href="$CMS_TRIM(level:4)$$CMS_VALUE(contextPage)$$CMS_REF(content.external_link,abs:2)$$CMS_END_TRIM$"/>

result is like below,

<atom:link rel="detail" href="http://data.com ......ABS path is empty for the LINK(selected value)" />

AbsoluteClose.png

Absolute path is empty for the link even if i selected it...?Why this behaviour?

Thanks,

Siva

0 Kudos

Your code is overcomplicated to proof a potential problem 😕

But perhaps the problem isn't in the template code: Did you specify an absolute path ("prefix for absolute paths") in the corresponding generate task?

Peter

Hello Mr. Peter Jodeleit,

Thanks for you kind reply,mistake is on my side.....

I have fount out the problem,

CMS_INPUT_LINK name="csExternalTeaserLink" it is mapped to the database column "external_link".

to get the value of selected ref: external link teplate name "lt_downloadref" need to be used.There i did mistake.Now working fine.

OLD Code:

<atom:link rel="detail" href="$CMS_VALUE(contextPage)$$CMS_REF(content.external_link,abs:2)$"/>

New Code :

<atom:link rel="detail" href="$CMS_VALUE(contextPage)$$CMS_REF(content.external_link.lt_downloadref,abs:2)$"/>

Thanks,

Siva

0 Kudos

Fine, nice to see it's working for you Smiley Happy

Peter
0 Kudos

Hello Mr. Peter Jodeleit,

How to get the Absolute path for the news datasource(dataset link),

I am linking new news id to the one which is existing in the system.

for example 42506 is the news which is displaying in the screen and i am mapping 42580 to the news.

I could able to get the news id which i select for dataset link like 42580.

How to get the absolute path????

ex:only the bolded one is absolute path and the prefix is publishing host.

http://data.com/de/news/news_detail_page_128576.html


<!-- fs_id1: $CMS_VALUE(content.external_link.lt_entity.getDataset().getEntity().getValue("fs_id"))$ -->

output:

<!-- fs_id1: 128576 -->

Thanks,

Siva

0 Kudos

Hello,

I got the value by using like ,

$CMS_VALUE(content.external_link.lt_entity.getDataset().getEntity().getValue("fs_id"))$

Thanks,

Siva