Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

DennisBecker/lib-zandman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About lib-zandman

lib-zandman is a collection of classes which I use for my Zend Framework projects. They are published under the new BSD licence.

Usage

application.ini

If you want to use this library, add the following lines

autoloadernamespaces[] = "Zandman_"
pluginPaths.Zandman_Application_Resource = "Zandman/Application/Resource/"

Zandman_Application_Resource_Router

resources.router.config = APPLICATION_PATH "/configs/routes.php"

Zandman_Application_Resource_Navigation

resources.navigation.config = APPLICATION_PATH "/configs/navigation.php"
resources.navigation.storage.registry = 1

Zandman_Translate_Adapter_Database

Usage with Zend_Application_Resource_Db

resources.db.adapter = "Pdo_Mysql"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.host = "localhost"
resources.db.params.dbname = "zandman"
resources.translate.adapter = "Zandman_Translate_Adapter_Database"
resources.translate.data.0 = ""
resources.translate.dbModel = "Application_Model_Translations"

Usage with Zend_Application_Resource_Multidb

resources.multidb.translate.adapter = "Pdo_Mysql"
resources.multidb.translate.username = "root"
resources.multidb.translate.password = ""
resources.multidb.translate.host = "localhost"
resources.multidb.translate.dbname = "zandman"
resources.translate.adapter = "Zandman_Translate_Adapter_Database"
resources.translate.data.0 = ""
resources.translate.dbAdapter = "translate"
resources.translate.dbModel = "Application_Model_Translations"

Example Model 'Application_Model_Translations'

<?php
class Application_Model_Translations implements Zandman_Translate_Database_ModelInterface
{
    /**
     * @var Zend_Db_Adapter_Abstract
     */
    protected $dbAdapter;
    
    public function __construct(Zend_Db_Adapter_Abstract $dbAdapter)
    {
        $this->dbAdapter = $dbAdapter;
    }
    
    public function getTranslations($locale)
    {
        $locale = new Zend_Locale($locale);
        
        
        $select = $this->dbAdapter->select();
        $select->from("language_key", "language_key")
        ->joinLeft("translations", "language_key.id = translations.language_key_id", "translation")
        ->joinLeft("language", "language.id = translations.language_id", array())
        ->where("language.language = ?", $locale->getLanguage());
        
        return $this->dbAdapter->fetchPairs($select);
    }
}

About

my library for expanding Zend Framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages