Skip to content

Instantly share code, notes, and snippets.

<?php
$header_data = array(
array(
'header_background' => 'background-image:url(../img/header/header_sun12.jpg)',
'header_elements' => array(
array(
'img_link' => "link1.php",
'img_title' => "Link Titel",
'img_pos_left' => 240,
'img_pos_top' => 10,
@steffenr
steffenr / cakephp.php
Created February 28, 2011 08:26
cakephp recursive
<?php
$this->Hour->Job->bindModel(array('hasOne' => array('UsersJob')));
$jobs = $this->Hour->Job->find('all', array(
'fields' => array('Job.id', 'Job.title', 'Job.description'),
'conditions' => array('UsersJob.user_id' => $this->user_id, 'Job.deleted' => 0),
'recursive' => 0
));
?>
<?php
require_once 'File/CSV/DataSource.php';
$path = "my_csv.txt";
$csv = new File_CSV_DataSource;
$csv->settings = array(
delimiter' => '|',
'eol' => ";",
'length' => 999999,
'escape' => '"'
);
<meta name="title" content="The Title Of The Link" />
<meta name="description" content="A description of the link would go here." />
<link rel="image_src" type="image/jpeg" href="http://www.domain.com/path/my_picture.jpg" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Share DrupalCon Copenhagen/title>
<meta name="title" content="Drupalcon Copenhagen" />
<meta name="description" content="Join us.." />
<link rel="image_src" href="http://port11.de/files/cph_logo_0.png" />
</head>
<?php
if (isset($_GET["file"])) {
$file_name = $_GET["file"];
if (file_exists($file_name)) {
header(”Content-type: application/x-download”);
header(”Content-Disposition: attachment; filename=$file_name”);
header(”Content-Transfer-Encoding: binary”);
header(’Content-Length: ‘ . filesize($file_name));
ob_clean();
flush();
<?php
$db = ConnectionManager::getDataSource("mydatabase_extern");
$sql_extern = "SELECT id, name FROM table_extern";
$result = $db->query($sql_extern);
?>
<?php
$this->Model->setDataSource("db_extern"); // wechseln der Datenbankverbindung
$this->Model->findAll(...);
$this->Model->setDataSource("default"); // zurückwechseln zur "normalen" Verbindung
?>
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'mypassword',
'database' => 'mydatabase',
'encoding' => 'utf8'
@steffenr
steffenr / gist:847064
Created February 28, 2011 08:11
theme date 'all' label drupal
<?php
function mytheme_date_all_day_label() {
return '';
}
?>