1. Seraf Dos Santos
  2. codeigniter-qzones-library

Overview

HTTPS SSH
codeigniter-qzones-library by Serafim Junior Dos Santos Fagundes Cyb3r Network

Version 1.0

MIT License

Copyright (c) 2010 Serafim Junior Dos Santos Fagundes Cyb3r Network

Needs codeigniter-xhtml-library
Needs codeigniter-qpanel-library

--------------------------------------------------------------------------------

codeigniter-qzones-library is a library for the CodeIgniter framework. Its a
layout (QLayout) library and a companion library of codeigniter-qview-library.
Its goal is to ease XHTML document creation and templatization with the internal
usage of codeigniter-xhtml-library.

Go see codeigniter-xhtml-library, codeigniter-qpanel-library and 
codeigniter-qview-library for more information.

--------------------------------------------------------------------------------
Usage
=====


# The library is automagically loaded when a declared usager is done with Qview
# -----------------------------------------------------------------------------

# Go see Qview fo a detailled usage sample. I'll be brief here and concentrate
# the reader on Qzones.


class My_qview extends Qview
{
	public function __construct( $params )
	{
		parent::__construct( $params );
	}
	
	public function init()
	{
		parent::init( $this );
		
		parent::_Reg( Qview::head, 'title', '_title' );
		
		parent::_Reg( Qview::body, 'content', '_content' );
	
	
		# The Qzones library is loaded by Qview when registered with
		# _RegQVLLib()
		# ----------------------------
		
		parent::_RegQVLLib( 'qzones', 'qz', $init_params );
		
		# Registration is similar to _Reg().
		# 'qzones' is the library name. 
		# 'qz' is the trigger name, called as a method.
		# $init_params is an array with class instance parameters.
		# --------------------------------------------------------
	}
	
	public function _title()
	{
		$title = $this->oCI->xhtml->title( 'My document title' );
		
		return $title;
	}
	
	public function _content( $array_params )
	{		
		$h1 = $this->oCI->xhtml->h1( $array_params['welcome_str'] );
		
		return $h1;
	}
}

# End of Qview class extension.
# -----------------------------


# Remember that the Qzones library is a CodeIgniter library. Save it in the
# appropriate folder and Qview will load it when registered.


# In the view file...
# -------------------

# ( See codeigniter-qview-library for more information )


$this->my_qview->init();

$this->my_qview->head->attach()->title();

# (1)
$this->my_qview->body->qz( Qzone::Top )->attach()->content();

$this->my_qview->output();


# End of view file
# ----------------


# Lets examine the view file code, (1) more precisely
# ---------------------------------------------------
#
#  (1) : o First, you can only call Layout libraries in the body part, not in
#          the head.
#        o qz() is the registered layout trigger name which maps to a method
#          receiving a coordinate value. Coordinate values are declared as class
#          constants in Qzones.
#        o attach() links the 'content' trigger to qz() coordinate and the
#          'body' part.
#        o content() is the registered callback trigger. 
#


# Interesting facts
# -----------------
# You can develop layout libraries if you find Qview a valuable tool. You'll 
# have to make your new QLayout class by implementing the interface that comes
# with the Qview library.


Thanks for looking. Email me for any information.