Skip to content

Instantly share code, notes, and snippets.

View renepardon's full-sized avatar

Christoph, René Pardon renepardon

View GitHub Profile
@renepardon
renepardon / mypackage.spec
Created August 11, 2011 14:19
Experiencing with .spec files for .rpm building
%if 0%{?rhel} || 0%{?centos_version}
# RedHat | CentOS
BuildRequires: php-devel >= 5.2
Requires: php5 >= 5.2
%else
%if 0%{?fedora}
# Fedora
BuildRequires: php5-dev >= 5.2
Requires: php5 >= 5.2
%endif
@renepardon
renepardon / gist:1190999
Created September 3, 2011 10:45
ORM or just Zend_Db_Tabble?
<?php
$this->_em->setTable('user'); // Sets DbTable-class to use.
$users = $this->_em->findById(1); // Returns a collection of users found.
$user = $users->first(); // Get only the first user.
$user->setFirstname('Max');
$user->setLastname('Mustermann');
$this->_em->save($user); // Update user information.
@renepardon
renepardon / gist:1204671
Created September 8, 2011 20:51
Firebug shows 500?
<?php
namespace Yela;
class PageNotFoundException
extends Exception
{
public function __construct(
$message = 'The requested site was not found on this server',
$code = 404,
<?php
// Create new module navigation page(s).
$moduleConfig = new \Zend_Config_Xml($configPath . $iterator->getFilename(), 'navigation', true);
// Add modules as pages to base navigation.
$navigation->addPage($moduleConfig);
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
<navigation>
<dashboard>
<label>Dashboard</label>
<module>base</module>
<controller>admin-index</controller>
<action>index</action>
<route>admin</route>
<type>mvc</type>
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
<navigation>
<user>
<label>Users</label>
<module>user</module>
<controller>admin-index</controller>
<action>index</action>
<route>admin</route>
<type>mvc</type>
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/">
<navigation>
<contact>
<label>Contact</label>
<module>contact</module>
<controller>admin-index</controller>
<action>index</action>
<route>admin</route>
<type>mvc</type>
<?php
// Base navigation.
$configPath = APPLICATION_PATH . '/configs/navigation/admin/';
$config = new \Zend_Config_Xml($configPath . 'base.xml', 'navigation', true);
// Create base navigation.
$navigation = new \Zend_Navigation($config);
// Module navigations.
$iterator = new \DirectoryIterator($configPath);
object(Zend_Config_Xml)#421 (9) {
["_skipExtends":protected] => bool(false)
["_allowModifications":protected] => bool(true)
["_index":protected] => int(0)
["_count":protected] => int(1)
["_data":protected] => array(1) {
["contact"] => object(Zend_Config)#425 (8) {
["_allowModifications":protected] => bool(true)
["_index":protected] => int(0)
["_count":protected] => int(7)
if (_data.dialog.uri) {
// Open dialog with and load content stored at uri.
$('<div>').dialog($.extend(params, {
open: function ()
{
$(this).load(_data.dialog.uri);
}
}));
}