Search the FirstSpirit Knowledge Base
Hello,
is it possible to create an empty array in Format Template, then create a variable in Section Template and execute PUSH to the array in Format Template? Or is it possible to create a variable in Section Template and use the value of it in Format Template? I want to use a content from one of the fields (in this case <h1> from a Section Template) in such a way that its content may be placed in the <head> page as <meta> (definied in Format Template).
I'll have same question to move data (variable) from Database Schemata to Format Template.
PK
Hi Patryk,
if i understand your requirements correct you want to want to use content from a section of a page in its header. Therefore in you template hierarchy the source of your data (the section) is in a lover level as the target (the format template of the head).
Take a look at the documentation regarding variables and especially contexts and its sub pages. I think they could contain the way to solve your problem.
FirstSpirit Online Documentation - Variables in FirstSpirit
FirstSpirit Online Documentation - Contexts
Greetings
Sandro
Please forgive my indolence. Despite the references to the documentation, I can not deal with one issue. In the simplest terms, I need to create a variable (CMS_SET) in Page Template and pass it to Format Template and display it there (CMS_VALUE). Is there a way to do it?
I solved the previous problem of transferring the value of a variable from Section Template to Page Template as follows:
Section template:
$CMS_SET(#global.context("root")[VARIABLE_NAME_1], VALUE)$
Page template:
$CMS_VALUE(VARIABLE_NAME_1)$
$-- shows the value of the variable correctly --$
So my problem is now to:
Page template:
$CMS_SET(VARIABLE_NAME_2, VARIABLE_NAME_1)$
Format template (how to?):
$CMS_VALUE(VARIABLE_NAME_2)$
...?
Hi Patryk,
Page template:
$CMS_SET(VARIABLE_NAME_2, VARIABLE_NAME_1)$
Format template (how to?):
$CMS_VALUE(VARIABLE_NAME_2)$
This should work, as long as you set the variable on the page template before rendering the format template
$CMS_SET(VARIABLE_NAME_2, VARIABLE_NAME_1)$
$CMS_RENDER(template:FORMAT_TEMPLATE_NAME)$
$CMS_VALUE(VARIABLE_NAME_2)$
This should show the value of the variable correctly...
Greetings
Kevin