本文整理汇总了C#中Template.InitContent方法的典型用法代码示例。如果您正苦于以下问题:C# Template.InitContent方法的具体用法?C# Template.InitContent怎么用?C# Template.InitContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.InitContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setDbConfig
public void setDbConfig()
{
String dbType = ctx.Post( "dbType" );
String dbAddress = ctx.Post( "dbAddress" );
String dbName = ctx.Post( "dbName" );
String user = ctx.Post( "user" );
String pwd = ctx.Post( "pwd" );
String connectionString = createConnectionString( dbType, dbAddress, dbName, user, pwd );
String strConfig = getConfigTemplate();
Template t = new Template();
t.InitContent( strConfig );
t.Set( "connectionString", connectionString );
t.Set( "dbType", dbType );
String fileName = "/config/orm_test.config";
String filePath = strUtil.Join( cfgHelper.FrameworkRoot, fileName );
String dataPath = PathHelper.Map( filePath );
file.Write( dataPath, t.ToString() );
echoAjaxOk();
}
示例2: viewContent
/// <summary>
/// 自定义当前视图模的内容(自定义内容之后,默认的模板将被忽略)
/// </summary>
/// <param name="templateContent">模板的内容</param>
public void viewContent( String templateContent )
{
Template t = new Template();
t.InitContent( templateContent );
utils.setCurrentView( t );
}
示例3: testMsgHtml
public void testMsgHtml()
{
String html = @"<!DOCTYPE html>
<html lang=""zh-CN"">
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
<title>_{sysMsg}</title>
<link href=""~css/wojilu._common.css?v=#{cssVersion}"" rel=""stylesheet"" type=""text/css"" />
<script>var __funcList = []; var _run = function (aFunc) { __funcList.push(aFunc); }; var require = { urlArgs: 'v=#{jsVersion}' };</script>
</head>
<body style=""background:#fff;"">
<div style=""width:500px;margin:50px auto;background:#efefef; border:1px #ccc dotted; line-height:150%"">
<div style=""padding:15px; "">
<div>#{msg}</div>
<div style=""margin:20px 0px 10px 0px;font-size:14px;font-weight:bold; text-align:center;"" id=""msgInfoGlobalSite"">
<a href=""javascript:history.back();"">‹‹ _{return}</a>
<span id=""lnkHome"" class=""link"" data-link=""#{siteUrl}"" style=""margin-left:30px""><img src=""~img/home.gif""/>_{siteHome}</span>
</div>
</div>
</div>
<script>
_run( function() {
$('#lnkHome').click( function() {
wojilu.tool.forwardPage( $(this).attr('data-link') );
});
});
</script>
<script data-main=""~js/main"" src=""~js/lib/require-jquery-wojilu.js?v=#{jsVersion}""></script>
<script>require(['wojilu._nolayout']);</script>
</body>
</html>";
Template t = new Template();
t.InitContent( html );
String ret = t.ToString();
Console.WriteLine( ret );
}
示例4: setDbConfig
public void setDbConfig()
{
String dbType = ctx.Post( "dbType" );
String dbName = ctx.Post( "dbName" );
String connectionStr = ctx.Post( "connectionStr" );
String connectionString = createConnectionString( dbType, dbName, connectionStr );
if (ctx.HasErrors) {
echoText( errors.ErrorsText );
return;
}
String strConfig = getConfigTemplate();
Template t = new Template();
t.InitContent( strConfig );
t.Set( "connectionString", connectionString );
t.Set( "dbType", dbType );
String fileName = "/config/orm.config";
String filePath = strUtil.Join( cfgHelper.FrameworkRoot, fileName );
String dataPath = PathHelper.Map( filePath );
file.Write( dataPath, t.ToString() );
sys.Clear.ClearAll();
echoAjaxOk();
}