Skip to content

Instantly share code, notes, and snippets.

View khepin's full-sized avatar

Sebastien Armand khepin

  • San Francisco, USA
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns
<table:table-row table:style-name="ro1">
<table:table-cell/>
<table:table-cell table:style-name="ce1" office:value-type="string">
<text:p>Name</text:p>
</table:table-cell>
<?php foreach($students as $student):?>
<table:table-cell table:style-name="ce1" office:value-type="string">
<text:p><?php echo $student->getName()?></text:p>
</table:table-cell>
<?php endforeach;?>
<?php
class MyExcel {
public static function setContent(sfEvent $event, $response) {
if (in_array(self::$format, self::$acceptedFormats)) {
//add content file
$doc = new ZipArchive();
$doc->open(sfConfig::get('sf_data_dir') . '/documents/report/my_report.ods');
$doc->addFromString('content.xml', $response);
<?php
class MyExcel {
private static $format = '';
private static $acceptedFormats = array('ods', 'xls', 'pdf');
public static function setFormat(sfEvent $event) {
self::$format = $event['format'];
}
<?php
$app = require __DIR__.'/../src/app.php';
$app->run();
<?php
/** Bootstraping */
require_once __DIR__.'/../vendor/Silex/silex.phar';
$app = new Silex\Application();
/** App Definition */
$urls = array(
'goog' => 'http://www.google.com',
<?php
namespace Khepin;
class UrlService {
private $urls = array(
'goog' => 'http://www.google.com',
'fb' => 'http://www.facebook.com',
);
public function get($short){
<?php
use Khepin\UrlService;
/** Bootstraping */
require_once __DIR__.'/../vendor/Silex/silex.phar';
$app = new Silex\Application();
$app['autoloader']->registerNamespaces(array('Khepin' => __DIR__,));
$app['url_service'] = function() {
<?php
/** Bootstraping */
//... previous code, unchanged ...
$app->register(new Silex\Extension\TwigExtension(), array(
'twig.path' => __DIR__.'/templates',
'twig.class_path' => __DIR__.'/../vendor/Twig/lib',
'twig.options' => array('cache' => __DIR__.'/../cache'),
));
@khepin
khepin / gist:917114
Created April 13, 2011 07:15
layout.html.twig
<!DOCTYPE HTML>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<title>Welcome to TSUSBOS - The Simple URL Shortener Based On Silex</title>
</head>
<body>
<div id="content">{% block content %}{% endblock %}</div>
</body>
</html>