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>info@eobasi.com</authorEmail>
    <authorUrl>http://www.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.

License

This software is intended for use with Oxwall Free Community Software http://www.oxwall.org/ and is a proprietary licensed product. For more information see Oxwall store commercial license https://developers.oxwall.com/store/oscl.

Set Document Key, Copyright 2018 Ebenezer Obasi.

Set Document Key is distributed under the terms of Oxwall Store Commercial License (OSCL).

Redistribution and use in source and binary forms, with or without modification, are not permitted provided.

This program is distributed in the hope that it will be useful, provided by the copyright holders and contributors “AS IS” and any express or implied warranties, including, but not limited to, the implied warranties of MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE are disclaimed.

In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.