Skip to content

Instantly share code, notes, and snippets.

@steffenr
steffenr / gist:847061
Created February 28, 2011 08:09
cakephp, booster
<?php
include('booster/booster_inc.php');
$booster = new Booster();
$booster->css_source = array(
'../css/smoothness/jquery-ui-1.8.5.custom.css',
'../css/jquery.fcbkcomplete.css',
'../css/formalize/formalize.css',
);
$booster->js_source = array(
'../js/lib/jquery-1.4.4.min.js',
@steffenr
steffenr / gist:847064
Created February 28, 2011 08:11
theme date 'all' label drupal
<?php
function mytheme_date_all_day_label() {
return '';
}
?>
<?php
class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'root',
'password' => 'mypassword',
'database' => 'mydatabase',
'encoding' => 'utf8'
<?php
$this->Model->setDataSource("db_extern"); // wechseln der Datenbankverbindung
$this->Model->findAll(...);
$this->Model->setDataSource("default"); // zurückwechseln zur "normalen" Verbindung
?>
<?php
$db = ConnectionManager::getDataSource("mydatabase_extern");
$sql_extern = "SELECT id, name FROM table_extern";
$result = $db->query($sql_extern);
?>
<?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();
<!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>
<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" />
<?php
require_once 'File/CSV/DataSource.php';
$path = "my_csv.txt";
$csv = new File_CSV_DataSource;
$csv->settings = array(
delimiter' => '|',
'eol' => ";",
'length' => 999999,
'escape' => '"'
);
@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
));
?>