Is there a way I can read system variables like rxs_navbase, which I set in content explorer, from a preprocessor extension?
Ravi
Is there a way I can read system variables like rxs_navbase, which I set in content explorer, from a preprocessor extension?
Ravi
Ravi,
Out of the box, CM System does not provide a direct way to access publishing data, such as Context Variables, in content services such as preprocessor extentions.
Can you explain what you want to do? We might be able to suggest an alternative.
RLJII
Basically I have a requirement to automatically create content items. And for each site we have different folders where we want to create them. Our content managers want to maintain the folders where these items need to be created. One logical place for them to set these parametrs would be at site properies level. As such I was trying to see if I can read those variables.
Ravi
An individual item is not explicitly tied to any particular site. The context variables also depend up the specific context you are publishing. Are you trying to just set a set of default values for these items? If so it would be best to have some code that looks for those defaults in a content item placed in the root of the site. I know one of my colleagues has recently looked at something similar, I will check what the status is of that. This is not good for all cases, you have to think about what would happen if you moved or copied the item to another site, or update these default values. if the the values on the main item should be updated to reflect the changes this mechanism is not appropriate, dynamically pulling in the site level values at assembly time would be better, or a combination of the two.
public IPSSite getSiteForPath(String path) {
String[] pathArray = new String[] { path };
for(IPSSite site : PSSiteManagerLocator.getSiteManager().findAllSites()) {
if(PSStringUtils.findMatchingLeftSubstring(site.getFolderRoot(), pathArray) != null)
return site;
}
return null;
}
After that, use the IPSSite interface to get your context variables… you’ll have to hard-code a content number, so I’d go with something pretty straightforward like 0 (Preview). I’m not yet sure how to build the context object for that tho.
Hello Team,
Does any one ever accessed the Context Variables set up on Sites? If yes, can you provide the sample code. Any advice is appreciated.
Explanation : We need the value of Context variable set up on sites, such that it is used in Post-processor Extension of Editions. Right now we are using value from Editions. But when we sync production environment to non prod or moving editions with a deployment we need to update the values of this variable on Editions based on environment. With number of editions and environments we have, it is time consuming during the deployments. So thought of setting up the variable at site level, such that it is easy for maintenance.
Thanks
Thiresh Buddi
[QUOTE=rljohnson;17839]Ravi,
Out of the box, CM System does not provide a direct way to access publishing data, such as Context Variables, in content services such as preprocessor extentions.
Can you explain what you want to do? We might be able to suggest an alternative.
RLJII[/QUOTE]