Custom Locations and Master pages

From WebRatio WebML Wiki

Jump to: navigation, search


Custom Location

When defining a Page Template, it's possible to choose the position of the Grid with the tag <wr:Grid />.

[...]
<tr>
  <td valign="top">
    <wr:Grid/>
  </td>
</tr>
</table>
</td>
<td width="100%" valign="top" align="right" height="100%" style="padding-left:30px">
  <table cellspacing="0" cellpadding="0" height="100%">
[...]

During the generation, the Grid tag is substituted with the code generated by the elements contained.

It's possible to define specific locations in a Page template, besides the main grid, where the designer may insert content units and sub pages: these locations are called Custom Locations. Custom Locations are defined with the tag <wr:CustomLocation/> and can be positioned wherever you want in a Page Template.

The <wr:CustomLocation/> has the mandatory attribute "name": a name which uniquely identifies a custom location. This name is used in the Grid View of WebRatio for displaying the custom location.

In the following example there is a Custom Location with name "Right Location", on the right of the Grid.

[...]
  <td width="100%" valign="top" style="padding-left:15px;" height="100%">
    <table cellspacing="0" cellpadding="0" width="100%" height="100%">
      <tr>
        <td class="eyebrow" height="22">
          <wr:NavigationBar linkClass="small" separator=" > "/> > <span>
            <wr:PageTitle/>
          </span>
        </td>
      </tr>
      <tr>
        <td valign="top">
          <wr:Grid/>
        </td>
      </tr>
    </table>
  </td>
  <td width="100%" valign="top" align="right" height="100%" style="padding-left:30px">
    <table cellspacing="0" cellpadding="0" height="100%">
      <tr>
        <td height="22"></td>
      </tr>
      <tr>
        <td valign="top" align="right" style="padding-top:3px;">
          <wr:CustomLocation name="Right Location"/>
        </td>
      </tr>
    </table>
  </td>
[...]

Now, using the Custom Location "Right Location" it's possible to insert content in the page, on the right of the Grid, by dragging elements in the Custom Location, in the Grid View.

Master Page

Suppose that you need to publish in every page of a Web application the data of the currently logged in user. You need to add to every page a Data Unit with a Get Unit to display the user data. We also need to maintain all these units (add/remove attributes).

Image:CurrentUserNoMasterPage.png Image:CurrentUserNoMasterPageDetail.png

In WebRatio it's possible to realize this feature using the Master Page. All the elements contained in the Master Page are automatically inherited by all the pages defined in the same container (siteview or area). Since the Master Page is a special page, it has no Grid. To publish Content Units, the Master Page uses the Custom Locations defined in the page templates set on the inheriting pages. In this way, to show the currently logged user data in every page, you just need to add a Master Page and put the Data Unit in a Custom Location.

Image:CurrentUserWithMasterPage.png

As said before, every page inherits the elements placed in Custom Locations in the Master Page:

It's possible to define a single Master Page in each container; pages will inherit the contents from the nearest Master Page.

Image:CustomLocationSeveralMasterPage.png

In the example above, every page inherits the currently logged in user from the first Master Page. The pages inside the "Products" area, inherits the "Product of the day" from the second Master Page. The Master Page in the "Products" area overwrites the contents of the Master Page defined in the SiteView.


Related articles:
Category Difficulty Refers
Context Parameters Web Model Beginner Get Unit
Set Unit
Reset Unit
Create Unit Web Model Beginner Create Unit
Create a "Hello world" application Web Model Beginner Site View
WebML
WebRatio
Create a "Simple data centric" web application Web Model Beginner Site View
WebML
WebRatio
Custom Locations and Master pages Web Model Beginner Master Page
Custom Location
… further results












Did you find this article useful? Please rate it!

Rating: 3.0/5 (2 votes cast)

Personal tools