Skip to main content

Get GID of PageRef

Comments

4 comments

  • Zendesk API User
    Author: hoebbel - 7/3/2024 14:38

    Hi Connz,

    you can use the GidAgent within the template code, too.

    $CMS_SET(gidAgent,#global.requireSpecialist(class("de.espirit.firstspirit.common.GidAgent").TYPE))$ GID: $CMS_VALUE(gidAgent.getGid(#global.node))$

    Best regards
    Holger

    0
  • Zendesk API User
    Author: cpe - 7/3/2024 15:47

    Hey Holger,

    thanks! That is great! I did not know, I could do that!

    But there is no way to get that into the content form for the template, is there?

    Cheers
    Connz

    0
  • Zendesk API User
    Author: hoebbel - 7/4/2024 7:25

    Hello Connz,

    the GID of the page is just a breeze

    <RULE when="ONLOCK"> <WITH> <PROPERTY name="GID" source="#global"/> </WITH> <DO> <PROPERTY name="VALUE" source="name_of_entry_component"/> </DO> </RULE>

    The GID of the pageref (and if there are more than one, which one?) is a different level. A good solution could be a value service that fetches the information (and takes into account that there may be none, one or many page references) and then writes it to an input component (executed once onlock or onsave)
    Another solution might be a script that writes the information (regularly as a schedule entry, during the preview, via an EventListener when saving, ...). However, this solution will often encounter locked IDProviders (since it doesn't use the session of the editor)

    Best regards
    Holger

    0
  • Zendesk API User
    Author: cpe - 7/4/2024 8:46

    Hey Holger,

    yes, that was my first attempt as I also assumed I just needed the GID of the page. Such a nice solution! But I indeed need the GID of the PageRef.

    Good point about there not being a 1-to-1 of Page to PageRef and the consequences of that. So far I have not seen projects that really make use of that in their daily doing, but it could be done of course.

    I think I will stick with my little script for now.

    Thanks for the input!

    Cheers
    Connz

    0

Please sign in to leave a comment.