Skip to content

Instantly share code, notes, and snippets.

View omoon's full-sized avatar

Sotaro OMURA omoon

View GitHub Profile
<?php
phpinfo();
?>
@omoon
omoon / gist:2474981
Created April 24, 2012 00:36
2012/04/27 FuelPHP 勉強会題材
<html>
<head>
<meta charset="utf-8">
<title>
2012/04/27 FuelPHP 勉強会題材
</title>
</head>
<body>
<form>
名前:<input type="text" name="name" />(必須)<br />
@omoon
omoon / gist_css_for_my_blog.css
Created May 29, 2012 06:32
gist css for my blog
/* GIST
----------------------------------------------- */
div.gist-highlight pre .line span {
font-family: Consolas, Monaco, 'Courier New', monospace;
font-size: 14px;
}
@omoon
omoon / gist:2833838
Created May 30, 2012 04:57
how to get the pdo object in FuelPHP
\Database_Connection::instance()->connect();
$pdo = \Database_Connection::instance()->connection();
<?php
/**
* APP_PATH/config/db.php
*/
return array(
'default' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=test',
@omoon
omoon / gist:3009613
Created June 28, 2012 07:01
エラーメールのテンプレート
============
<?php echo $severity; ?>!
============
<?php echo $type; ?> [ <?php echo $severity; ?> ]: <?php echo $message; ?>
<?php echo $filepath; ?> @ line <?php echo $error_line; ?>
@omoon
omoon / gist:3009662
Created June 28, 2012 07:23
エラーメール送信スクリプト
// APPPATH/views/errors/php_error.php
<div style="border: 1px solid #CCC; padding: 10px; background-color: #FFF; color: #333;">
<p style="font-size: 13px; color: #333;"><strong><?php echo $severity; ?>!</strong></p>
<p style="font-size: 13px; color: #333;"><?php echo $type; ?> [ <?php echo $severity; ?> ]: <?php echo $message; ?></p>
<p style="font-size: 13px; color: #333;"><strong><?php echo $filepath; ?> @ line <?php echo $error_line; ?>:</strong></p>
<pre style="font-size: 13px; color: #333; border: 1px solid #EEE; padding: 3px 3px 3px 8px; margin: 0;overflow: auto;"><code><?php
if (is_array($debug_lines)):
echo ($error_line - 1).":\t".e(trim($debug_lines[$error_line - 1]))."\n";
echo "<strong>{$error_line}:\t".e(trim($debug_lines[$error_line]))."</strong>\n";
@omoon
omoon / gist:4230226
Created December 7, 2012 02:22
FuelPHP My Fieldset class
<?php
class Myfieldset extends \Fieldset
{
/**
* フォーム要素をviewで使いやすい配列で取得
*/
public function getFormElements($open = '', $hidden = array())
{
if (is_array($open)) {
$attr = $open;
@omoon
omoon / gist:4230585
Created December 7, 2012 03:42
sample.php
class Controller_Welcome extends Controller
{
public function action_index()
{
$fieldset = Myfieldset::forge('sample');
$fieldset->addTextForNumeric('age', '年齢');
$fieldset->addRadioWithBr('gender', '性別', array(1 => '男', 2 => '女'));
$fieldset->addRadioInline('season', '一番好きな季節', array(1 => '春', 2 => '夏', 3 => '秋', 4 => '冬'));
$view = View::forge('welcome/index');
$view->set_safe(array('form' => $fieldset->getFormElements('post_url')));
@omoon
omoon / sample.php
Created December 7, 2012 03:43
sample view
<?php echo $form['open']; ?>
<h2>何歳やねん?</h2>
<table class="table table-bordered">
<tr>
<th class="span2"><?php echo $form['age']['label'];?></th>
<td><?php echo $form['age']['html'];?> 歳</td>
</tr>
</table>