官术网_书友最值得收藏!


Creating a custom template>

When you create a theme from scratch, you also have to link the templates to the theme. You can copy templates from another theme to your newly created theme. But you can also create new templates from scratch. We will create a new template in this recipe.

Getting ready

We can go on with theme 115 that we made in the first recipe, so make sure you already created this theme.

How to do it...

  1. In Application Builder, go to the application you are working on. After that, go to the Shared components.
  2. In the shared components page, click on Templates.
  3. Click on the Create button to start the wizard.
  4. In the next step you see nine types of templates. Select the Region template.
  5. Click on From scratch and click on the Next button.
  6. Enter a name for this new template, that is, cust_rep_reg. You can also select the theme this new template should be part of. And finally, select the template class. In our case, we select the Reports region. Click the Create button to finish the wizard.
  7. The new template has now been created and you can see it in the list. Edit the new template by clicking on the template name (cust_rep_reg).
  8. You can use HTML in combination with the substitution strings to create a layout. Oracle replaces the substitution strings with the component values. You can find the substitution string at the bottom of the page:
  9. You can use the following example to enter in the definition section:
    <table class="t115Region" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES# border="0" cellpadding="0" cellspacing="0" summary="" width="97%" style="border:none;">
    <tbody class="ReportsRegion">
    <tr>
    <th class="t115RegionHeader">#TITLE#</th>
    <th class="t115ButtonHolderHeader" width="100%">#CLOSE#&nbsp;&nbsp;#PREVIOUS##NEXT#&nbsp;#DELETE##EDIT##CHANGE##CREATE##CREATE2##EXPAND##COPY##HELP#</th>
    </tr>
    <tr>
    <td class="t115RegionBody" colspan="2" bgcolor="lightgrey">#BODY#</td>
    </tr>
    </tbody>
    </table>
    [T115region.txt]

    This template code is a copy of the original code from theme 18, but with the background color set to light grey.

    Substitution strings should be written in uppercase and should begin and end with a #-sign. As from APEX 4.0, new templates use the <div> tag. The older templates from APEX 3.2 and before used the<table> - <tr> - <td> tags.

  10. Click on the Apply changes button.
  11. If you want to use the new template, you have to change the pages/regions which will use this new template. Suppose you have a page with a tabular form. Click on the page you want to edit.
  12. Click on the region you want to edit.
  13. In the template listbox, select the new template, cust_rep_reg. You can find the template listbox in the user interface section.
  14. Click on the Apply changes button. The region will now use this new template.

There's more...

You can make your newly created template the default template for that specific component type. Just go to the Shared components page, go to the themes, and select the theme you want to edit. On the right side of the screen, under Tasks, click on Edit theme. You will see the component defaults. In the region listbox, select the new template. Click on the Apply changes button. The new template is now the default for the region component type.

主站蜘蛛池模板: 永靖县| 突泉县| 历史| 顺昌县| 闻喜县| 巴塘县| 嘉荫县| 荥经县| 裕民县| 武宁县| 德化县| 利川市| 商洛市| 邢台县| 苏尼特右旗| 陵川县| 泌阳县| 巫溪县| 吐鲁番市| 商都县| 龙江县| 固阳县| 承德县| 东乡| 托克托县| 临颍县| 新丰县| 普格县| 无棣县| 太保市| 南昌县| 繁昌县| 千阳县| 新兴县| 临桂县| 东乌珠穆沁旗| 酒泉市| 怀集县| 太保市| 宁国市| 嘉黎县|