Introduction to Zend Framework

 Learning Zend Framework

appendix

 Zend Framework Reference


  •  Zend_Gdata
  •  Zend_Http
  •  Zend_InfoCard
  •  Zend_Json
  •  Zend_Layout
  •  Zend_Ldap
  •  Zend_Loader
  •  Zend_Locale
  •  Zend_Log
  •  Zend_Mail
  •  Zend_Markup
  •  Zend_Measure
  •  Zend_Memory
  •  Zend_Mime
  •  Zend_Navigation
  •  Zend_Oauth
  •  Zend_OpenId
  •  Zend_Paginator
  •  Zend_Pdf
  •  Zend_ProgressBar
  •  Zend_Queue
  •  Zend_Reflection
  •  Zend_Registry
  •  Zend_Rest

  •  Zend_Search_Lucene
  •  Zend_Serializer
  •  Zend_Server
  •  Zend_Service
  •  Zend_Session
  •  Zend_Soap
  •  Zend_Tag
  •  Zend_Test
  •  Zend_Text
  •  Zend_TimeSync
  •  Zend_Tool
  •  Zend_Tool_Framework
  •  Zend_Tool_Project
  •  Zend_Translate
  •  Zend_Uri
  •  Zend_Validate
  •  Zend_Version
  •  Zend_View
  •  Zend_Wildfire
  •  Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Update 2011-11-16 - Revision 24438 - Version ZF 1.11.x

    Chapter 66. Zend_Tag

    66.1. Introduction

    Zend_Tag is a component suite which provides a facility to work with taggable Items. As its base, it provides two classes to work with Tags, Zend_Tag_Item and Zend_Tag_ItemList. Additionally, it comes with the interface Zend_Tag_Taggable, which allows you to use any of your models as a taggable item in conjunction with Zend_Tag.

    Zend_Tag_Item is a basic taggable item implementation which comes with the essential functionality required to work with the Zend_Tag suite. A taggable item always consists of a title and a relative weight (e.g. number of occurrences). It also stores parameters which are used by the different sub-components of Zend_Tag.

    To group multiple items together, Zend_Tag_ItemList exists as an array iterator and provides additional functionality to calculate absolute weight values based on the given relative weights of each item in it.

    Example 66.1. Using Zend_Tag

    This example illustrates how to create a list of tags and spread absolute weight values on them.

    // Create the item list
    $list = new Zend_Tag_ItemList();

    // Assign tags to it
    $list[] = new Zend_Tag_Item(array('title' => 'Code''weight' => 50));
    $list[] = new Zend_Tag_Item(array('title' => 'Zend Framework''weight' => 1));
    $list[] = new Zend_Tag_Item(array('title' => 'PHP''weight' => 5));

    // Spread absolute values on the items
    $list->spreadWeightValues(array(12345678910));

    // Output the items with their absolute values
    foreach ($list as $item) {
        
    printf("%s: %d\n"$item->getTitle(), $item->getParam('weightValue'));
    }

    This will output the three items Code, Zend Framework and PHP with the absolute values 10, 1 and 2.


    digg delicious meneame google twitter technorati facebook

    Comments

    Loading...