Important

Major updates are in progress. Some pages and languages may not be available.

Displaying the Output

Now we're ready to build and display the output... the pull quote. Remember the $quote variable that you created previously? Now we need to create it.

Building the quote
$quote .= "<div style='float:".$f.";width:".$w."'>";
	$quote .= "<div class='pullquote'><div class='content' style='color:".$c.";'>";
	$quote .= $data;
	$quote .= "</div></div></div>";

The $data variable represents the actual quote text. Remember the error checking from before, to ensure that the text isn't empty?

  • The $f represents the position.
  • The $w represents the width.
  • The $c represents the color.

 Tip

Notice that the text of the pull quote is enclosed in a named &lt;div&gt; element. This allows you to customize the styling by Adding Custom CSS Styles. For example, you could style the quote with:
Sample CSS
.pullquote  {
font-family:Times,serif;
font-size:1.6em;
font-style:italic;
font-weight:bold;
line-height:1em;
margin:10px;
padding:20px 10px;
}

Using the Plugin

Now that you've built the Pullquote plugin, it is time to use it in wiki page.

  1. Copy the wikiplugin_pullquote.php plugin file to the ../lib/wiki-plugins/.. directory.
    Your plugin should look similar to:
    The completed PULLQUOTE plugin
    <?php
    
    // Wiki plugin to create a pull quote
    // Created as part of Tiki Essentials: http://twessentials.tikiforsmarties.com
    // By Rick Sapir, Copyright (C) 2010. All rights reserved.
    // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE (LGPL).
    
    function wikiplugin_pullquote_help() {
    	return tra("Create a literary pullquote").":<br />  §2036c98259e3ef63760985c45a0c296b§  ";
    	}
    
    function wikiplugin_pullquote_info() {
    	return array(
    		'name' => tra('pullquote'),
    		'description' => tra('Create a literary pullquote in a wiki page.'),
    		'validate' => 'all',
    		'params' => array(
    			'color' => array(
    				'required' => false,
    				'name' => tra('Code of the pullquote'),
    				'description' => tra('Numeric hex color code (default=000000). Do *NOT* include #.'),
                                    'filter' => 'int',
    			),
    			'width' => array(
    				'required' => false,
    				'name' => tra('Width of the pullquote'),
    				'description' => tra('Numeric width in pixels (default=250). Do *NOT* include px.'),
                                    'filter' => 'int',
    			),
    			'float' => array(
    				'required' => true,
    				'name' => tra('Specify location of the pull quote.'),
    				'description' => tra('left | right (default=left)'),
                                    'filter' => 'alpha',
    			),
    
    		),
    	);
    }
    
    function wikiplugin_pullquote($data, $params) {
    // Always include this line to read the data and parameters.
    
    	extract ($params,EXTR_SKIP);
    
    	$quote ='';
    
    // Check for color
    	if (!isset($color))
    	{
    // Set default color
    		$c = '#000000';
    	} else {
    		$c = '#'.$color;
    	}
    
    // Check for width
    	if (!isset($width))
    	{
    // Set default width
    		$w= '250px';
    	} else {
    		$w = $width . 'px';
    	}
    
    // Check for position
    if (!isset($float))
        {
    // No position, tell the user
            $msg = 'Please select a position: left or right.';
            return $msg;
            die;
        } else {
    // Set the position
            $f = $float;
        }
    
    //Build the output	
    	$quote .= "<div style='float:".$f.";width:".$w."'>";
    	$quote .= "<div class='pullquote'><div class='content' style='color:".$c.";'>";
    	$quote .= $data;
    	$quote .= "</div></div></div>";
    
    	return $quote;
    }
    
    ?>
  2. In Tiki, use the Admin: Text Area page to enable the plugin.

     Tip

    If you don't see the plugin, be sure to clear your Tiki cache.
  3. Add your newly created plugin to a wiki page.
    Adding the plugin
    Adding the PULLQUOTE plugin to a wiki page.
  4. If the plugin requires approval (if you specified the security), use the Plugin Approval page to approve it.
    Plugin approval
    Approving the PULLQUOTE plugin.


If you create useful plugins, please consider contributing them back to the Tiki community. It is quick and easy. Here's how...

Advertising