Example #1
0
ReplyPtr TempaltePageHandler::Process(ContextPtr ctx)
{
	try
	{
		StringPtr page(new std::string(ctx->Cfg()->PageTemplate()));

		ReplaceAll(ReplaceAll(page, 
			"{{VIEWS}}", ctx->Db()->Views()->AllAsJson()), 
			"{{CURRENT_VIEW}}", ctx->Query()->HasView() ?  "'" + ctx->Query()->ViewName() + "'" : "null"); 


		return Html(page);
	}
	catch(Exception& fe)
	{
		return Handler::Error(fe, true);
	}
	catch(std::exception& e)
	{
		return Handler::Error(FUGU_EXCEPT(e.what() ,"TempaltePageHandler::Process"), true);
	}
}