Sightly variables scope
Hi all,
I used to have a jsp file for global variables. Is there an equivalent in sightly?
Suppose I have
public class AbstractModel{
@PostConstruct
public void init(){
// -- initiate all base variables
}
public String getModelName()
{
return AbstractModel.class.getName();
}
}
public class AbstractPage extends AbstractModel{
@PostConstruct
public void init()
{
// more vars here for page templates
}
}
public class NewsLandingPage extends AbstractPage{
// blah blah
}
public class NewsComponent extends AbstractModel{
// blah blah
}
HTL templates
global.html
<sly data-sly-use.abm="my.site.AbstractModel"/>
<sly data-sly-use.abPage="my.site.pages.AbstractPage"/>
<!--/* other customized global variables */-->
<!-- global info: ${abm.modelName }-->
for newslanding
newslanding.html
<sly data-sly-include="global.html"/>
<!-- newslanding info: ${abm.modelName} -->
Output:
<!-- global info: my.site.AbstractModel -->
<!-- newslanding info: -->
I would expect both to return the same name, but the landing page fails. How can I extend the global visibility to other files?
Thank you very much!
-kt