Hi Simon, You might want to try using web context.
Put your var in context (page scope): [code] ${ctx.setAttribute('videoNumber', videoNumber, 0)} [/code] Get your var from context: [code] [#assign videoNumber = ctx.getAttribute('videoNumber')] [/code] bye Vincent ________________________________________ De : user-list-ow...@magnolia-cms.com <user-list-ow...@magnolia-cms.com> de la part de Simon (via Magnolia Forums) <fo...@magnolia-cms.com> Envoyé : mercredi 23 décembre 2015 17:23 À : Magnolia User List Objet : [magnolia-user] Setting global variables without using the freemarker config Hey guys, I would like to set a global variable without using javascript or changing the freemarker template. What I am trying to achieve is the following: I can add muliple video's to a page, the video play button opens a modal with a certain ID. These modals need to have unique id's. What I have tried: [code] [@cms.page /] [#assign videoNumber = 0 /] [/code] [code] [#assign pageNode = cmsfn.page(content)! ] [#if pageNode.videoNumber!?has_content] [#assign pageNode.videoNumber = pageNode.videoNumber +1 /] [/#if] [/code] I also tried setting the variable and just changing it, but that doesn't work either, because it does not register (only exists within the current component). Any ideas? -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=206673ac-0a3d-4663-ab6b-e4b32d315dc8 ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------