Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

What is this article for

...

You will learn how to create and use your own HTML page outputs using CB and get a solid understanding of CB's built-in output for customizations.

...

  • Each view has a unique name

  • Each view has a view folder named after the view's name, containing certain files

  • These view folders are in {application folder}/views

  • Custom view folders are in {customization folder}/views

  • Each view folder has a PHP file named view.html.php containing a view class (ConfigboxView{view name} extending KenedoView)

  • Each view folder has a sub folder called 'tmpl' with a template file

...

Assume a view called 'example' in the customization folder on Joomla:

{customization folder}/views/example/view.html.php
{customization folder}/views/example/tmpl/default.php

...

Assume a view called 'example'. File location {customization folder}/views/example/view.html.php

Code Block
languagephp
class ConfigboxViewExample extends KenedoView {
	
	/**
	* @var string[] 
	*/
	var $dataForMyTemplate;


	function prepareTemplateVars() {
		$this->dataForMyTemplate = array('so', 'much', 'to', 'show');
	}

}

(template file in {customization folder}/views/example/tmpl/default.php)

...

Location of controller files: {customization folder}/controllers/{controller name}.php (in our example 'example.php')

Code Block
languagephp
class ConfigboxControllerExample extends KenedoController {
	
	/**
 	* @return NULL
 	*/
	protected function getDefaultModel() {
		return NULL;
	}


	/**
	 * @return ConfigboxViewExample
	 */
	protected function getDefaultView() {
		return KenedoView::getView('ConfigboxViewExample');
	}


	/**
	 * @return NULL
	 */
	protected function getDefaultViewList() {
		return NULL;
	}

	/**
	 * @return NULL
	 */
	protected function getDefaultViewForm() {
		return NULL;
	}

}

(controller file in {customization folder}/controllers/example.php)

...

KenedoViews control which style sheets the platform will load. Mind that CB loads a stylesheet for customizations on any page that shows a KenedoView - best use this one when it fits your needs.

...

  • Always return the parent function's URLs along with your URLs

  • No need to worry about duplications (e.g. in case of multiple views rendered). The framework filters out duplicates.

  • If you use minified CSS, put the original and minified version on the site and return the non-minified version of the stylesheet. The framework will look for a .min.css file and use it instead.

  • See about cache invalidation for these stylesheets.

  • Use KenedoPlatform::p()->getUrlCustomizationAssets() to get the URL to the customization assets folder.

  • In case a separate stylesheet is overkill for your use-case, use the custom.css stylesheet instead.

Requests to framework to load JS modules, execute functions

See this article.