Cheatography
https://cheatography.com
Output.aspx example for Crownpeak
Example input.aspx
Input.ShowHeader("Contact Us");
Input.ShowTextBox("Page Title", "page_title");
Input.ShowAcquireImage("Contact Us Logo", "contact_us_logo");
Input.ShowTextBox("Contact Us Logo Alt Text", "contact_us_logo_alt_text");
Input.ShowWysiwyg("Address", "address", ServicesInput.FullWYSIWYG());
Input.ShowTextBox("Customer Service Phone", "customer_service_phone");
Input.ShowTextBox("Email", "email");
|
Place in Project\Templates\SomeTemplateName
Example OutputHelper Class
public static class OutputHelper
{
public static string OutputImage(OutputContext context, Asset asset, string imageAssetName, string altTextAssetName)
{
UploadedFile file = asset.UploadedFiles[imageAssetName];
if (file.IsLoaded)
{
Img img = Img.Load(file);
if (!img.HasError)
return string.Format("<img src='{0}' width='{1}' height='{2}' alt='{3}' />", file, img.Width, img.Height, asset[altTextAssetName]);
else if (!context.IsPublishing)
return string.Format("Error Loading image {0}. Error: {1}", img.ErrorMessage, imageAssetName);
}
return string.Empty;
}
public static string OutputMailTo(Asset asset, string emailAssetName, string linkText= null)
{
if (!string.IsNullOrEmpty(asset[emailAssetName]))
{
if (!string.IsNullOrEmpty(linkText))
return string.Format("<a href='{0}'>{1}</a>", asset[emailAssetName], asset[linkText]);
else
return string.Format("<a href='{0}'>{0}</a>", asset[emailAssetName]);
}
return string.Empty;
}
}
|
Place in Project\Library
Example Output.aspx
<h1><%= asset["page_title"] %></h1>
<%= OutputHelper.OutputImage(context, asset, "contact_us_logo", "contact_us_logo_alt_text") %>
<p><%= asset["address"] %></p>
<p><%= asset["customer_service_phone"] %></p>
<p><%= OutputHelper.OutputMailTo(asset, "email") %></p>
|
Place in Project\Templates\SomeTemplateName
Other Useful Helpers
<% var siteRootPath = Asset.GetSiteRoot(asset).AssetPath.ToString(); %>
<%= ServicesOutput.RenderCSSLink(siteRootPath + "/css/style.css") %>
<%= ServicesOutput.RenderScriptLink(siteRootPath + "/js/util.js") %>
<%= ServicesOutput.RenderHyperLink(asset, "buy_now") %>
|
|
Created By
www.kellermansoftware.com
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by GregFinzer