close ad
 
Important WebAssist Announcement
open ad
View Menu

Web development tutorial

Use templates in PowerCMS

Tutorial created by Ray Borduin, WebAssist

Categories: Design Extender

rating

PowerCMS 2 has a templating feature that adds useful functionality for certain websites. This feature is most commonly used for news websites and blogs and is not expected to be used by all PowerCMS implementations.

The following tutorial explains the process of setting up a template and how you can create new pages based on that template.

NOTE: Unless you have a specific use for a template you should not select the Use as template option for the pages you create in PowerCMS.

arrow downWhat you need to start

  1. PowerCMS 2 functioning on your live server.
  2. Web Browser (Firefox, Internet Explorer, Safari etc.)
  3. WYSIWYG or Text Editor for minor code changes.

arrow downCreate the template

The first step in using the PowerCMS template feature is to create the template that the pages will be based on.

  1. Sign in to your CMS site as the Super Admin.
  2. Choose the green icon from the top of the Content column.
  3. Enter the name of the template.
    For example, 'newsarticle'.
  4. Select the Use as template checkbox.
  5. Click OK.


The template is added to PowerCMS like any other page but is distinguished by a different icon.

arrow downAdd the content areas

Content areas are added to the template just like you would any normal content location (page) in PowerCMS.

  1. Choose the template from the Contents column.
  2. Add all the content areas to your template in PowerCMS.


When you or your client adds new pages based on this template, the new pages will have all the same content areas as the template for them to modify to contain their new information.

arrow downApply the Developer Notes

As with a normal Content Location (page) in PowerCMS, you need to add the Developer Notes for each content area of your template, to the PHP page you wish to use for these pages.

You will use only one PHP page to display all the pages that are created based on this template. You or your client will be provided with a URL variable that they will append to the PHP page's URL to view the new page's content.
  1. Select the template from the Content column.
  2. Click the Developer Notes link for the first content area.
  3. Highlight the Developer Notes and press Ctrl (Cmd) C to copy.
  4. In your preffered editor, open the PHP page you wish to use to display these pages.
  5. In Code View, place your cursor where you wish this content area's content to display.
  6. Press Ctrl (Cmd) V to paste the Developer Notes.
  7. Repeat this process for all other content areas you have added to your template.
  8. Save the PHP file and upload to your live server.

arrow downCreate new dynamic page

When creating a new page based on your template you are not creating a new PHP file on your site. Instead, you are creating a different set of content for the same PHP file. This allows you (or your client) to quickly add new pages from within PowerCMS without having to create new files or enter any code.

Adding pages based on a template in PowerCMS can be performed by any Administrator.

  1. In PowerCMS, hover your mouse over the template you created and click the green button that appears.
  2. Enter a name for the new article/page.
    The name should be specific to help you identify the post in PowerCMS.
  3. Click OK to create the page.
    The new page is created as a subpage of the template containing all the content areas of that template.
  4. In PowerCMS, edit the content areas of the new page as desired.

arrow downView the dynamic page

Once you have created a new page based on a template in PowerCMS, you can quickly view that page by obtaining the URL variable that is to be added to the end of the template PHP page URL.

This URL variable will only work on the page where the Developer Notes for the template have been added. If you are handing this off to a client that is expected to create new pages using this feature, you should make sure that the client knows which page this URL variable should be added to.

Step 1: Locating the URL Variable for the Super Admin

  1. In PowerCMS, select the new page from the Content Column
  2. Click the Developer Notes link for any of the content areas of that page.
  3. Highlight the URL variable provided in the 'Display this content without this code...' section.
  4. Press Ctrl (Cmd) C to copy.
  5. In your browser, navigate to the page that the template's Developer Notes have been applied to.
  6. Place your cursor at the end of the URL in the Address bar, and press Ctrl (Cmd) V to paste.
    The URL will look something like http://mysite.com/template.php?article=4
  7. Press Go or Enter to navigate to this page.
    The content will update on the page to reflect what was added to the new page.

Step 2: Locating the URL Variable for the regular Admins

  1. In PowerCMS, select the new page from the Content Column
  2. Click the Create Link option for any of the content areas of that page.
  3. Highlight the URL variable and press Ctrl (Cmd) C to copy.
  4. In your browser, navigate to the page that the template's Developer Notes have been applied to.
  5. Place your cursor at the end of the URL in the Address bar, and press Ctrl (Cmd) V to paste.
    The URL will look something like http://mysite.com/template.php?article=4
  6. Press Go or Enter to navigate to this page.
    The content will update on the page to reflect what was added to the new page.

arrow downWhat to do next...

Now that you have the URL to use for your new page you can create links throughout your site to that new page you just created. You can insert the link directly within the HTML Editor for any content area in the CMS.

Also...

The PHP file that you applied the Developer Notes to will automatically display the most recent page's content that was added to the CMS. This way, you can easily use that page as a "Most Recent Article" or "Newest Blog Post" without having to update the link everytime you add a new page.

arrow downReviews and comments

Comments will be sent to the author of this tutorial and may not be answered immediately. For general help from WebAssist, please visit technical support.

Sign in to add comments
rating

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.