Umbraco Basic Concepts

download Umbraco Basic Concepts

of 12

  • date post

    01-Jun-2018
  • Category

    Documents

  • view

    219
  • download

    1

Embed Size (px)

Transcript of Umbraco Basic Concepts

  • 8/9/2019 Umbraco Basic Concepts

    1/12

    P a g e | 1

    UMBRACO BASIC CONCEPTS

    INDEX

    Contents

    DOCUMENT TYPES....................................................................................................2

    What is a Doc!e"t T#$e%....................................................................................2

    C&eati"g Doc!e"t T#$es.....................................................................................2

    Wo&'i"g (ith Doc!e"t T#$es..............................................................................)

    WEB PA*ES.............................................................................................................. +

    C&eate a We, Page................................................................................................ +

    TEMP-ATES...............................................................................................................+

    What is a te!$ate%..............................................................................................+

    C&eati"g a "e( te!$ate.......................................................................................+

    MACROS................................................................................................................./2

    What is a Mac&o%................................................................................................./2

    C&eati"g a Mac&o................................................................................................./2

    Sa!$e Mac&o...................................................................................................../0

    USE1U- RE1ERENCES............................................................................................./

  • 8/9/2019 Umbraco Basic Concepts

    2/12

    P a g e | 2

    DOCUMENT TYPES

    What is a Document Type?Doc!e"t T#$e is a" i!$o&ta"t ee!e"t o3 U!,&aco. It 4e5"es the 5e4s that ca"

    ,e e4ite4 o" a $age. Doc!e"t T#$es a&e !a4e $ o3 P&o$e&ties6 Ta,s6 St&ct&e

    a"4 I"3o.

    TheInfo ta, sets ce&tai" 4etais o3 the Doc!e"t T#$e sch as the

    Doc!e"t T#$e "a!e a"4 (hich te!$ates it ca" se.

    TheStuctue ta, sets (hich chi4 Doc!e"t T#$es ca" ,e c&eate4

    "4e& this Doc!e"t T#$e.

    The!eneic Popetiesta, is (he&e #o s$eci3# (hat 'i"4 o3 co"te"tca" go o" (e, $ages that a&e ,ase4 o" this Doc!e"t T#$e. These

    P&o$e&ties 4ete&!i"e (hich 5e4s a"4 co"t&os ca" a$$ea& o" #o& (e,

    $age.

    TheTa"s ta, is (he&e #o s$eci3# the ta,s that (i sho( $ (he" #o

    c&eate a (e, $age ,ase4 o" this Doc!e"t T#$e. A3te& #o c&eate a ta,6

    #o ca" assig" P&o$e&ties to it i" the P&o$e&ties ta,.

    Ceatin# Document Types

    /. *o to Sectio"s 78 Setti"gs

  • 8/9/2019 Umbraco Basic Concepts

    3/12

    P a g e | $

    2. Right Cic' the 1o4e& 9Doc!e"t T#$es: 78 Seect 9C&eate:

    0. *o to 9Ta,s: ta, to a44 "e( ta,s i3 &e;i&e4. No(6 (e ca" sta&t a44i"g

    9P&o$e&ties: "4e& these ta,s.A $&o$e&t# is

  • 8/9/2019 Umbraco Basic Concepts

    4/12

    P a g e | %

    Sa

  • 8/9/2019 Umbraco Basic Concepts

    5/12

    P a g e | &

    Seect the $age to e4it its co"te"t.

    Wo'in# (ith Document Types

    Add references to the following namespaces at the top of your .cs file

    usingumbraco.BusinessLogic;

    usingumbraco.cms.businesslogic.web;

    Perform the creation

    //Get the type you would like to use by its alias//and the user who should be the creator of the document

  • 8/9/2019 Umbraco Basic Concepts

    6/12

    P a g e | )

    DocumentTypedt =DocumentType.GetBylias!"Te#tpage"$;

    %serauthor =%ser.Get%ser!&$;

    //create a document with a name' a type' an umbraco user' and the (D of the

    document)s parent page.

    //To create a document at the root of umbraco' use the id *+

    Documentdoc =Document.,ake-ew!",y new document"'dt'author'+&+$;

    //after creating the document' prepare it for publishing

    doc.ublish!author$;

    //Tell umbraco to publish the document

    umbraco.library.%pdateDocument0ache!doc.(d$;

    Re!e!,e& to a44 the c!s.46 ,si"essogic.4 a"4 !,&aco.4 to the $&oect.

    The $&o$e&ties o3 a Doc!e"t T#$e ca" ,e !o4i5e4 as ,eo(

    Modify the document properties and publish the changes

    // Get the document by its (D

    Documentdoc =newDocument!+&12$;

    // Get the properties you wish to modify by it)s alias and set their 3alue

    // the 3alue is sa3ed in the database instantly4

    doc.getroperty!"bodyTe#t"$.5alue="6p78our body te#t6/p7";

    doc.getroperty!"articleDate"$.5alue=DateTime.-ow;

    // fter modifying the document' prepare it for publishing

    %serauthor =%ser.Get%ser!&$;

    doc.ublish!author$;

    // Tell umbraco to publish the document so the updated properties are 3isible on

    websiteumbraco.library.%pdateDocument0ache!doc.(d$;

    WE* P+!ES

  • 8/9/2019 Umbraco Basic Concepts

    7/12

    P a g e | ,

    We, $ages i" U!,&aco a&e ,ase4 o" Doc!e"t T#$es. The&e3o&e6 it (i ,e ,ette& i3

    (e co4 c&eate a 4oc!e"t t#$e ,e3o&e a44i"g the $age.

    Ceate a We" Pa#e

    1. Go to Sections panel > Content. Web pages will appear as nodes in the Content panel.2. If you do not yet have any web pages, create one by rightclic!ing on Content and choosing

    Create.

    ". #nter a na$e for the page and clic! Create. %he page will show up under the Content folder&refresh your browser page if you need to'.

    (. Clic! on your new page. In the right panel, you will see the tabs that allow you to set the contentthat will appear on the page.

    ). #nter the content for the page, by entering content in the tabs in the $ain panel. If you wantyour page to contain $ore types of content than are allowed here, you $ust edit the *ocu$ent%e$plate which is used by the page. %o see which *ocu$ent %ype the page uses, go to the

    +roperties tab for the web page.

    . When you-re done, clic! the save and publish/ button in the tool bar.

    0. %o see how your page loo!s in $braco, go to the +roperties tab for that page, then clic! the3in! to *ocu$ent 43 at the botto$ of the tab.

    TEMP-+TES

    What is a temp.ate?Te!$ates 4e5"e the a#ot a"4 $&ese"tatio" o3 a (e, $age. A" !,&aco te!$ate

    is ,asica# te?t 7 sa# @X>t! 7 co!,i"e4 (ith !,&aco tags @ee!e"ts. Whie

    c&eati"g a "e( Doc!e"t T#$e6 a !atchi"g te!$ate 3o& it ca" ,e c&eate4 ,#

    eithe& seecti"g the chec',o? 9C&eate Matchi"g Te!$ate: o& ,# c&eati"g a "e(

    te!$ate ,# 3oo(i"g the 3oo(i"g ste$s.

    Ceatin# a ne( temp.ate/. *o to Setti"gs 78 Right cic' o" 9Te!$ates: 3o4e& 78 seect 9C&eate:.2. O$e" the "e(# c&eate4 te!$ate.

    Co$# Paste the &e;i&e4 >TM- co4es 3&o! the $&oect.

  • 8/9/2019 Umbraco Basic Concepts

    8/12

    P a g e | /

    0. The $age $&o$e&ties o3 the te!$ate ca" aso ,e accesse4 ,# seecti"g

    9I"se&t U!,&aco Page 5e4: ,tto" i" the too,a&. U!,&aco (i "o( i"se&t

    the te!$ate !a&'$ "ee4e4 3o& the tite o3 the $age i"to the te!$ate.

  • 8/9/2019 Umbraco Basic Concepts

    9/12

    P a g e | 0

    . This te!$ate ca" ,e assig"e4 to a $age ,# goi"g to its $&o$e&t# ta, a"4

    seecti"g the te!$ate 3&o! the 4&o$4o(".

  • 8/9/2019 Umbraco Basic Concepts

    10/12

    P a g e | 1

    . P,ish a"4 &" the (e,site. The cha"ges !a4e i" the te!$ate (i &eFect

    i" the $age.

    ). Maste& te!$ates ca" ,e c&eate4 i" the sa!e (a# ,t it aso i"c4es thei"3o&!atio" a,ot i"se&ti"g the chi4 te!$ates. I" that case6 the tag G%

    UMBRACOH*ETITEM 5e4=,o4#Te?t=J8 !st ,e &e$ace4 (ith a"

    i"st&ctio" to i"se&t a chi4 te!$ate i"stea4 (hich is &e$&ese"te4 as =G%

    UMBRACOHTEMP-ATEH-OADHC>I-DJ8=. The te!$ate o3 the $age !st ,e

    !o4i5e4 to the Maste& Te!$ate.

  • 8/9/2019 Umbraco Basic Concepts

    11/12

  • 8/9/2019 Umbraco Basic Concepts

    12/12

    P a g e | 12

    Ki"he&its !,&aco.Mac&oE"gi"es.D#"a!icNo4eCo"te?tKsi"g!,&acoLKsi"g!,&aco.i"te&3acesLKsi"g!,&aco.No4e1actoLKsi"g-i3eti!e.C!s.Do!ai"LKsi"g-i3eti!e.C!s.Do!ai".E?te"sio"sL

    K

    INo4eC&&e"tNo4e No4eL

    t!.Ra( to sto$ the >TM- e"co4i"g K>t!.Ra(@co"te"t GJ4i