Skip to content

Instantly share code, notes, and snippets.

View maxparm's full-sized avatar

Maxime Parmentier maxparm

View GitHub Profile
@maxparm
maxparm / BaseUrl.php
Created January 21, 2011 23:55
library/IM/View/Helper/BaseUrl.php
<?php
class IM_View_Helper_BaseUrl extends Zend_View_Helper_Abstract
{
public function baseUrl()
{
return Zend_Registry::get('config')->app->baseUrl;
}
}
?>
@maxparm
maxparm / layout.phtml
Created January 22, 2011 00:25
html tag: base
<head>
<title></title>
<base href="<?php echo $this->baseUrl();?>" />
</head>
<body>
...
</body>
@maxparm
maxparm / application.ini
Created January 22, 2011 00:26
/application/configs/application.ini
[production]
app.baseUrl = "http://www.server.com"
[staging : production]
app.baseUrl = "http://staging.server.com"
[testing : production]
app.baseUrl = "http://testing.server.com"
[development : production]
@maxparm
maxparm / Bootstrap.php
Created January 22, 2011 00:36
/application/Bootstrap.php
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initConfig() {
//path of configuration file
$path = APPLICATION_PATH.'/configs/application.ini';
//Get the configuration data
$config = new Zend_Config_Ini($path);
@maxparm
maxparm / compile.php
Created February 3, 2011 00:02
Compile the doctrine library
<?php
require_once('/path_of_your_library/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
Doctrine_Core::compile('Doctrine.compiled.php');
?>
@maxparm
maxparm / Bootstrap.php
Created February 3, 2011 00:07
Bootstrap file
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function _initDoctrine()
{
$config = $this->getResource('config');
$config = $config['doctrine'];
require_once('Doctrine.compiled.php');
php compile.php
<?php
class Me_Controller_Plugin_Facebook extends Zend_Controller_Plugin_Abstract
{
public function preDispatch($request)
{
//Initialize Facebook Api
require(APPLICATION_PATH.'/../library/facebook.php');
$facebook = new Facebook(array(
'appId' => FACEBOOK_APIKEY,
'secret' => FACEBOOK_APISECRET,
@maxparm
maxparm / arrow.css
Created March 25, 2011 19:18
Arrow in CSS
<span></span>
<style>
span {
height:0;
width:0;
border-width:5px;
border-style:solid;
border-color:red transparent transparent transparent;
}
<?php
class View_Helper_BaseUrl extends Zend_View_Helper_Abstract
{
public function baseUrl()
{
return 'http://localhost/myapplication';
}
}
?>