CREATING YOUR OWN PACKAGES

Creating your own package is not only easy using the backoffice tools, but it's also handy for modularizing functionality that can be shared across all of your projects. Plus, if you've developed something that you think others may benefit from, why not share the goods? To create a package, follow these steps:

  1. Right-clicking the Packages node in the Developer section, as shown in Figure 10-6.

    FIGURE 10-6

    image

  2. Name your new package Site Breadcrumb by filling in the name field in the resulting popup.
  3. Fill in all the fields in the Package Properties tab, as shown in Figure 10-7.
    • Package URL: The URL of the site where this package is described/documented.
    • Package Version: That is, 1.0 or 0.1 and so on.
    • Package file: This field remains empty until you publish the package.
    • Author Name: Full name of the author of the project. Contributors can be added to the project details when uploading to the community site, but only one author should be listed as part of the package details.
    • Author url: Your blog or corporate site URL.
    • License Name: Researching the license model for the package is up to you. The default is MIT, just like the Umbraco core.
    • License url: This would be the URL for the details of your license.
    • Readme: This field is your opportunity to educate the installer of what the package does and to include any special instructions.

    FIGURE 10-7

    image

  4. Click the Package Contents tab and select the applicable elements to include. For this example, select the Site Breadcrumb check box in the Macros section, as shown in Figure 10-8.

    image You do not have to select the associated XSLT file for this package as that will automatically be included when selecting the macro. Same thing goes for .NET macros which will automatically include the associated .ascx files.

    If your package included .NET driven functionality, you would have to select the associated assemblies in the Package Files tab from the installation path of your website.

    FIGURE 10-8

    image

  5. Publish the package by clicking the Publish button, as shown in Figure 10-9.

    FIGURE 10-9

    image

  6. Navigate back to the Package Properties tab and download your new package by clicking the Download link.

Now, clearly that wasn't very exciting. All you did was create a package with one file in it, essentially. In Chapter 12 you will create a more complex macro that includes additional functionality such as .NET assemblies.

In addition to using the built-in tools for creating packages, you can extend the functionality by using the Package Actions tab. Package Actions are a means for you as a developer to execute common tasks during and after the installation process of a package. The actions are configured as instructions using XML. Examples of usage for these actions include adding an <umbraco:macro /> tag to an existing template, allowing a document type as a child element of another, or moving nodes in the content tree. Table 10-1 lists the available package actions.

TABLE 10-1: Package Actions

image

image

image

image /base is a class that you can use as a developer to execute REST-driven data exchange via, for example, AJAX calls.

image In addition to the package actions that come with your Umbraco installation, you can find a community-driven repository at http://packageactioncontrib.codeplex.com/.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset