Set Document Key – Oxwall Plugin

Adds unique document key and body class to all pages on your website.

Set Document Key oxwall plugin adds a unique document key and body class to all pages on your website.

With the document key you will be able to style individual pages of your website with css, js and create different master page layout.

You can download this plugin for free on the Oxwall Store https://developers.oxwall.com/store/item/1484. Check below for installation guide and usage.

Installation

If you are new to Oxwall, follow this tutorial on how to install Oxwall and Skadate plugin.

  1. In your admin panel, go to Plugins -> Add and click the ‘Add New’ button.
  2. Upload your copy of dockey.zip you have downloaded from the store.
  3. Go to Available Plugins, locate ‘Set Document Key‘ and click ‘Install‘

Set Document Key Usage

Time and time again, we encounter this particular problem where we need a style to appear only on a particular plugin or layout. Just then, you are shocked to realize that most developers do not specify a unique document key for that particular page.

Set Document Key Oxwall plugin automatically adds a unique document key across all the pages that is not assigned a unique key, using Oxwall built in functions.

OW::getApplication()->setDocumentKey( string $key );

You can apply js code or styles to a specific page using the document key.

CSS Style

/*Style Video List page heading*/ .video_ctrl_video_viewlist h1{ color: #ff0000; }

jQuery Code

//Append 'Testing Document Key' to video list page heading $('.video_ctrl_video_viewlist h1').append('Testing Document Key');

The plugin allows theme developers to go beyond the traditional index.html and general.html templates and setup template layouts for different pages and plugins.

Below is an Example of how it can be integrated into an Oxwall theme:

<?xml version="1.0" encoding="utf-8"?>
<theme>
    <name>Custom Theme</name>
    <key>custom_theme</key>
    <version>1.0</version>
    <compatibility>1.5 and higher</compatibility>
    <description>Custom theme sample with custom template layout for Video list page</description>     <author>Ebenezer Obasi</author>
    <authorEmail>[email protected]</authorEmail>
    <authorUrl>https://eobasi.com/</authorUrl>
    <developerKey>d7be028d4d1053345e0fd37184e5dadb</developerKey>
    <build>1</build>
    <copyright>(c) 2018 Ebenezer Obasi. All rights reserved.</copyright>
    <license>OSCL</license>
    <licenseUrl>http://www.oxwall.org/store/oscl</licenseUrl>
    <masterPages>
        <video_ctrl_video_viewlist>video</video_ctrl_video_viewlist>
    </masterPages>
</theme>

The above example is using the videos plugin. ‘video_ctrl_video_viewlist‘ is the unique key generated for the video list page.

  • ‘video’ is the plugin key
  • ‘ctrl’ is the package
  • ‘video’ is the controller
  • ‘viewlist’ is the action.

The unique key is generated in this order: pluginKey_ctrl_controller_action

The name between the <pluginKey_ctrl_controller_action></pluginKey_ctrl_controller_action> tag should be the name of the master page template for the document.

In our case, the template name is video. In theme/master_pages create a new html file for video.html. Going forward, video list page will use the video.html template instead of the general.html file used by default.

Post Tags:

  • developmentscc