- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
unique id in genric link output
Hello,
new to FS and need to know how to get a unique id in the html output of a link which is rendered via a generic link template and used in DOM-Editor and Linklist.
This works in a linklist, but is deprecated:
$CMS_SET(set_lt_id,#global.id.toString()+"_"+ #link.getAttributes().get("localId").toString())$
Thanks in advance
Thomas
- Labels:
-
Developers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What type of link are you using? Internal/External or a generic link?
What FirstSpirit Version are you using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Zitat: "rendered via a generic link template and used in DOM-Editor and Linklist."
Damit meinte ich, dass ich eine generischen Verweisvorlage verwende.
Version: 4.2.219.38784
Danke
p.S.: Aktuell helfe ich mir mit einem Zรคhler, der pro Lin hochgesetzt wir und so eine eindeutige ID pro Seite darstellt. Scheint mir aber sehr unpraktisch, zumal es ja mit den Vorversionen von FS mรถglich war IDs pro Link abzufragen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Within a generic link, you can access the component "localId" like this: $CMS_VALUE(localId)$.
So this should work:
$CMS_SET(set_lt_id,#global.id.toString()+"_"+ localId.toString())$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Thomas,
or do you just want to use the id of the target node?
This would be (assumed, that the link is set by the component "sitestoreref"):
$CMS_VALUE(ref(sitestoreref).target.id)$
or in your example something like this:
$CMS_SET(set_lt_id,#global.id.toString()+"_"+ ref(sitestoreref).target.id.toString())$
Best regards,
Holger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reply.
Unfortunately this does not work. $CMS_VALUE(localId)$ used in a genric link generates no output.
And it does not work for external links either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thomas Nommensen schrieb:
Thanks for reply.
Unfortunately this does not work. $CMS_VALUE(localId)$ used in a genric link generates no output.
Can you post the form of your generic link, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Holger. But if you have two links connected to the same target, you'll get the same ID, won't you?
I need a unique ID per page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are two links to the same page within the same section allowed?
If not, you could use:
$CMS_SET(set_lt_id,#global.section.id.toString()+"_"+ ref(sitestoreref).target.id.toString())$
If they are not allowed within the same component, you could add a constant for each component
$CMS_SET(set_lt_id,"0" + #global.section.id.toString()+"_"+ ref(sitestoreref).target.id.toString())$
$CMS_SET(set_lt_id,"1" + #global.section.id.toString()+"_"+ ref(sitestoreref).target.id.toString())$
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a simple form for an internal link. The form for the external one uses a normal CMS_INPUT_TEXT for the URL
<CMS_MODULE>
<CMS_INPUT_TEXT name="lt_text" useLanguages="no">
<LANGINFOS>
<LANGINFO lang="*" label="Bezeichner"/>
</LANGINFOS>
</CMS_INPUT_TEXT>
<FS_REFERENCE name="lt_link" useLanguages="no">
<FILTER>
<ALLOW type="pageref"/>
</FILTER>
<LANGINFOS>
<LANGINFO lang="*" label="Page reference"/>
</LANGINFOS>
<PROJECTS>
<LOCAL name=".">
<SOURCES>
<FOLDER name="root" store="sitestore"/>
</SOURCES>
</LOCAL>
</PROJECTS>
</FS_REFERENCE>
</CMS_MODULE>

