Training on Umbraco - Part II

download Training on Umbraco - Part II

of 19

Transcript of Training on Umbraco - Part II

  • 7/27/2019 Training on Umbraco - Part II

    1/19

    Training on Umbraco CMSPrepared by Shaishav Karna

  • 7/27/2019 Training on Umbraco - Part II

    2/19

    Agenda for Day 2

    BUILDINGASITE (PRACTICAL)

    SEO FRIENDLYSITE

    NODE, DYNAMICNODE, DOCUMENT, CONTENT & MEDIA API

    FORMS

    ADVANCED DATA TYPES DATA EDITORS

    EVENTS

    EXAMINE/SEARCH

  • 7/27/2019 Training on Umbraco - Part II

    3/19

    Goals of Day 2

    Build simple website

    Understanding of different topics on Umbraco CMS

  • 7/27/2019 Training on Umbraco - Part II

    4/19

    BUILDINGASITE (PRACTICAL)

    Basic Structure

    Site Navigation

    Home Page

    Text Page

    News & Events

    Handling Images & Gallery

  • 7/27/2019 Training on Umbraco - Part II

    5/19

    SEO FRIENDLYSITE SEO URL

    Meta Tags

    Other SEO features that can be optimized for the site

    Site Map Package

    Robot.txt editor package

    User Friendly URLs

  • 7/27/2019 Training on Umbraco - Part II

    6/19

    Node

    using umbraco.NodeFactory;

    // Fetch Nodes

    Node node = Node.GetCurrent();

    Node node = new Node(id);

    idrow2.Text = node.GetProperty("introText1").Value;

    //Fetch Child Nodes

    var childNodes = node.Children;

    foreach (Node childNode in childNodes)

    {

    Response.Write(string.Format("{0}
    ", childNode.Name));

    }

    //Fetch Media

    var mediaItem = umbraco.cms.businesslogic.media.Media(id)

    imageurl = mediaItem.getProperty("umbracoFile").Value.ToString();

  • 7/27/2019 Training on Umbraco - Part II

    7/19

    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 thedocument'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);

  • 7/27/2019 Training on Umbraco - Part II

    8/19

    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 = "

    Your body text

    ";

    doc.getProperty("articleDate").Value = DateTime.Now;

    // After modifying the document, prepare it for publishing

    User author = User.GetUser(0);doc.Publish(author);

    // Tell umbraco to publish the document so the updated properties are visible onwebsite

    umbraco.library.UpdateDocumentCache(doc.Id);

  • 7/27/2019 Training on Umbraco - Part II

    9/19

    CONTENT & MEDIA API Using Content & Media API with Razor (detail)

    Gateway to Umbraco Data

    Acess ConentService[ApplicationContext.Current.Services.ContentService]

    Umbraco.Core namespace

    ContentService Script (ContentService.txt) Using Content & Media API with User Controls (brief)

    http://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspx

    http://our.umbraco.org/documentation/Reference/Management-

    v6/Services/MediaService

    http://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaServicehttp://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaServicehttp://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaServicehttp://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaServicehttp://our.umbraco.org/documentation/Reference/Management-v6/Services/MediaServicehttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspxhttp://umbraco.com/follow-us/blog-archive/2013/1/22/introducing-contentservice-aka-the-v6-api.aspx
  • 7/27/2019 Training on Umbraco - Part II

    10/19

    FORMS Built User Generated Forms for the website

    Store user generated forms in the Content Node

  • 7/27/2019 Training on Umbraco - Part II

    11/19

    DATA EDITORS

    Extending Umbraco

    2 ways:-

    Usercontrol Wrapper

    Abstract DataEditors

  • 7/27/2019 Training on Umbraco - Part II

    12/19

    ADVANCED DATA TYPES

    Ultimate Picker

    uComponents

    SQL Dropdown

    URL Picker

    Custom Data Types

  • 7/27/2019 Training on Umbraco - Part II

    13/19

    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

  • 7/27/2019 Training on Umbraco - Part II

    14/19

    Abstract Data Editors

    Pros:

    Full control for appearance, configuration, storage andpublishing

    Cons: Very abstract and complex to implement

    Requires good knowledge of the umbraco core

  • 7/27/2019 Training on Umbraco - Part II

    15/19

    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

  • 7/27/2019 Training on Umbraco - Part II

    16/19

    EVENTS Overview on v4.7 events

    ApplicationEventHandler (v4.9)

    Overview on v6 events

    IApplicationEventHandler

    OnApplicationInitialized OnApplicationStarted

    OnApplicationStarting

  • 7/27/2019 Training on Umbraco - Part II

    17/19

    EVENTS (CONTD)

    Examples using v6 events [2.4 Events folder]

    PublishingStrategy

    Member.AfterSave += Member_AfterSave;

    Member.AfterDelete += Member_AfterDelete;

    Log.Add(LogTypes.Save, sender.Id, We are watching you!); Storing Published items into another database using Entity

    Framework & Events (Digital Textile)

  • 7/27/2019 Training on Umbraco - Part II

    18/19

    EXAMINE/SEARCH Introduction

    Part of core since 4.5

    Umbraco Examine is built on Examine, Umbraco and Lucene.n

    Powerful flexible, extensible and fast search engine forUmbraco

    Provider Model (Index and Search data source) Multiple Indexes

    Index Content, Media, Members

  • 7/27/2019 Training on Umbraco - Part II

    19/19

    EXAMINE/SEARCH(CONTD)

    Setting up search index

    Searching for Website

    Plugin (Examine Dashboard)

    http://umbraco.com/follow-us/blog-

    archive/2011/9/16/examining-examine.aspx

    http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspxhttp://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx