[opencms-dev] Changing projects in code

Niklas Eklund niklas at curalia.se
Fri Jul 11 15:14:02 CEST 2003


Try something like:

public String launch(CmsObject cms, String parameter) throws Exception {
	CmsRequestContext c = cms.getRequestContext();
	if (c.currentProject() != I_CmsConstants.C_PROJECT_ONLINE_ID) {
		c.setCurrentProject(I_CmsConstants.C_PROJECT_ONLINE_ID);
	}
	// online
	...
}

I think a cron job always starts in the online project though.

Regards,

  Niklas

M Butcher wrote:
> Okay, I have a piece code that should only be run in the online project
> so that it doesn't grab content that hasn't yet been published. 
> 
> How can I find out if the current project is the online project, and
> (more importantly) switch so that it is the current project.
> 
> Mainly, I want to make sure that a class that gets started from the cron
> interface can read a couple of files from the online interface and
> collect information about them.
> 
> Thanks,
> 
> Matt
> 
> 





More information about the opencms-dev mailing list