Skip to content

Instantly share code, notes, and snippets.

Avatar
🙂

Hari K T harikt

🙂
View GitHub Profile
View Zend_Form_Sample
<?php
// include auto-loader class
require_once 'Zend/Loader/Autoloader.php';
//register auto-loader
$loader = Zend_Loader_Autoloader::getInstance();
//setView
$view = new Zend_View();
$view->setEncoding("ISO-8859-1");
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
View Euler
<?php
/*
* There may be always a better solution than this .
* Problem : Some discussion in ipgofkerala group regarding http://bit.ly/d2ihwR ( Eulers problem http://projecteuler.net/ ) . Many of them came with C#, Clojure, Ruby, Python.. more??
* So I Just made some changes made by Sujeeth Nair in C++ to port to PHP
* I don't want PHP to miss this game :P
* Catch me at harikt.com
* Hari K T
*/
@harikt
harikt / doctrine.php
Created Aug 28, 2010
To create models specifically for the doctrine for each specific module for the videos of zendcasts.com . Keep this file in <project dir>/application/scriptsdoctrine.php Eg: $./doctrine < arguments for doctrine > module <module name > If no module is
View doctrine.php
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/..'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'doctrineCLI'));
@harikt
harikt / gist:656142
Last active Sep 24, 2015
Virtual host
View gist:656142
Replace the blog and public directory according to the names .
Sample which Ryan Mauger http://www.rmauger.co.uk/ helped me on #zf-talk .
<Bittarman> open your terminal, and type this,
sudo echo "127.0.0.1 blog.local www.blog.local" >> /etc/hosts
<Bittarman> then, sudo vim /etc/apache2/sites-available/blog.local
<Bittarman> and paste this into it http://pastie.org/1112846
<VirtualHost *:80>
@harikt
harikt / gist:656157
Created Oct 31, 2010
Creating your Lithium Project
View gist:656157
hari@hari-laptop:/var/www$ li3 library extract hellolithium
hellolithium created in /var/www from /var/www/lithium/libraries/lithium/console/command/create/template/app.phar.gz
hari@hari-laptop:/var/www$ cd hellolithium/
Lets see how it looks ;)
hari@hari-laptop:/var/www/hellolithium$ tree
.
|-- config
View example.php
<?php
/*
Going through the slides of phparch OOP THE PHP 5.3 Way
http://www.phparch.com/2010/11/29/codeworks-2010-slides/
A try at the example given by Marco Tabini. Some corrections was needed, just updated it ;) .
*/
namespace Blueparabola;
class example {
public function sayHello() {
echo 'I am from ' . __CLASS__ . " . Yes namespace \n";
@harikt
harikt / SearchesController.php
Created Jan 20, 2011
Located at controllers
View SearchesController.php
<?php
namespace app\controllers;
use \app\models\Search,
\Zend_Search_Lucene;
class SearchesController extends \lithium\action\Controller {
/*
@harikt
harikt / Search.php
Created Jan 20, 2011
Located at models
View Search.php
<?php
namespace app\models;
use \Zend_Search_Lucene,
\Zend_Search_Lucene_Document,
\Zend_Search_Lucene_Field;
class Search extends \lithium\data\Model {
@harikt
harikt / index.html.php
Created Jan 20, 2011
located at views/searches
View index.html.php
Search for <?= $query; ?> returned <?= count($searches)?> hits <br />
<ul>
<?php foreach ($searches as $hit) { ?>
<li><?= $this->html->link( $hit->url , $hit->url );?></li>
<?php } ?>
</ul>
View Comments.php
<?php
namespace app\models;
class Comments extends \lithium\data\Model {
public $validates = array();
public $belongsTo = array('Posts','Users');
You can’t perform that action at this time.