Training On Umbraco - Part II
Training On Umbraco - Part II
BUILDING A SITE (PRACTICAL) SEO FRIENDLY SITE NODE, DYNAMICNODE, DOCUMENT, CONTENT & MEDIA API FORMS ADVANCED DATA TYPES DATA EDITORS EVENTS EXAMINE/SEARCH
Goals of Day 2
Basic Structure
Site Navigation
Home Page Text Page News & Events Handling Images & Gallery
SEO URL
Meta Tags
Other SEO features that can be optimized for the site
Node
using umbraco.NodeFactory;
idrow2.Text = node.GetProperty("introText1").Value;
//Fetch Child Nodes var childNodes = node.Children; foreach (Node childNode in childNodes) { Response.Write(string.Format("{0}<br />", childNode.Name)); } //Fetch Media var mediaItem = umbraco.cms.businesslogic.media.Media(id) imageurl = mediaItem.getProperty("umbracoFile").Value.ToString();
Document
using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; Creating a Document //Get the type you would like to use by its alias DocumentType dt = DocumentType.GetByAlias("Textpage"); User author = User.GetUser(0);
//create a document with a name, a type, an umbraco user, and the ID of the document's parent page.
Document doc = Document.MakeNew("My new document", dt, author, 1018); //after creating the document, prepare it for publishing doc.Publish(author); //Tell umbraco to publish the document umbraco.library.UpdateDocumentCache(doc.Id);
Updating a Document
// Get the document by its ID Document doc = new Document(1029);
// Get the properties you wish to modify by it's alias and set their value
// the value is saved in the database instantly! doc.getProperty("bodyText").Value = "<p>Your body text</p>"; doc.getProperty("articleDate").Value = DateTime.Now;
Gateway to Umbraco Data Acess ConentService [ApplicationContext.Current.Services.ContentService] Umbraco.Core namespace ContentService Script (ContentService.txt)
http://our.umbraco.org/documentation/Reference/Managementv6/Services/MediaService
FORMS
DATA EDITORS
Extending Umbraco
2 ways:
Ultimate Picker
uComponents
Usercontrol Wrapper
Pros: A simple interface with just one property Supports for all control including ASP.NET AJAX Cons: No custom configuration No control of data storage No control of publishing
Pros:
Cons:
Very abstract and complex to implement Requires good knowledge of the umbraco core
Usercontrol Wrapper
Create a Usercontrol Reference umbraco.editorControls assembly Implements interface [umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor] It adds a single method [public object value {set, get}] Usercontrol will appear as a datatype Optional : Reference cms, interface, data assembly Add standard asp:Calendar control example
EVENTS
ApplicationEventHandler (v4.9)
Overview on v6 events
IApplicationEventHandler
OnApplicationInitialized
OnApplicationStarted OnApplicationStarting
EVENTS (CONTD)
PublishingStrategy
Member.AfterSave += Member_AfterSave; Member.AfterDelete += Member_AfterDelete;
Storing Published items into another database using Entity Framework & Events (Digital Textile)
EXAMINE/SEARCH
Introduction
Part of core since 4.5 Umbraco Examine is built on Examine, Umbraco and Lucene.net Powerful flexible, extensible and fast search engine for Umbraco Provider Model (Index and Search data source) Multiple Indexes
EXAMINE/SEARCH (CONTD)