Contenu connexe
Similaire à Who Needs Ruby When You've Got CodeIgniter (20)
Who Needs Ruby When You've Got CodeIgniter
- 1. WHO NEEDS RUBY WHEN YOU’VE
GOT CODEIGNITER?
Jamie Rumbelow
@jamierumbelow
CodeIgniter Conference, London, 2012
- 35. class User_model extends MY_Model { }
Text
class Post_model extends MY_Model { }
class Category_model extends MY_Model { }
- 46. class User_model extends MY_Model
{
public $validate = array(
array( 'field' => 'username', 'label' => 'Username',
'rules' => 'required|max_length[20]|alpha_dash' ),
array( 'field' => 'password', 'label' => 'Password',
'rules' => 'required|min_length[8]' ),
array( 'field' => 'email', 'label' => 'Email',
'rules' => 'valid_email' )
);
}
- 51. <div id="account">
<h1>
<?= $this->bank->get($account->bank_id)->name ?> - <?= $account->title ?>
</h1>
<p class="information">
<strong>Name:</strong> <?php if ($account->name): ?><?= $account->name ?><?php else: ?>N/
A<?php endif; ?><br />
<strong>Number:</strong> <?php if ($account->number): ?><?= $account->number ?><?php
else: ?>N/A<?php endif; ?><br />
<strong>Sort Code:</strong> <?php if ($account->sort_code): ?><?= substr($account->sort_code,
0, 2) . "-" . substr($account->sort_code, 2, 2) . "-" . substr($account->sort_code, 4, 2) ?><?php else: ?>N/
A<?php endif; ?>
</p>
<p class="balances">
<strong>Total Balance:</strong> <?php if ($account->total_balance): ?><?= "£" .
number_format($account->total_balance) ?><?php else: ?>N/A<?php endif; ?>
<strong>Available Balance:</strong> <?php if ($account->available_balance): ?><?= "£" .
number_format($account->available_balance) ?><?php else: ?>N/A<?php endif; ?>
</p>
<p class="statements">
<?php if ($this->statements->count_by('account_id', $account->id)): ?>
<?= anchor('/statements/' . $account->id, 'View Statements') ?>
<?php else: ?>
Statements Not Currently Available
<?php endif; ?>
</p>
</div>
- 52. <div id="account">
<h1>
<?= $account->title() ?>
</h1>
<p class="information">
<strong>Name:</strong> <?= $account->name() ?><br />
<strong>Number:</strong> <?= $account->number() ?><br />
<strong>Sort Code:</strong> <?= $account->sort_code() ?>
</p>
<p class="balances">
<strong>Total Balance:</strong> <?= $account->total_balance() ?>
<strong>Available Balance:</strong> <?= $account->available_balance() ?>
</p>
<p class="statements">
<?= $account->statements_link() ?>
</p>
</div>
- 55. public function title()
{
return get_instance()->bank->get($this->account->bank_id)->name .
"-" . $this->account->title;
}
- 58. <div id="account">
<h1>
<?= $this->bank->get($account->bank_id)->name ?> - <?= $account->title ?>
</h1>
<p class="information">
<strong>Name:</strong> <?php if ($account->name): ?><?= $account->name ?><?php else: ?>N/
A<?php endif; ?><br />
<strong>Number:</strong> <?php if ($account->number): ?><?= $account->number ?><?php
else: ?>N/A<?php endif; ?><br />
<strong>Sort Code:</strong> <?php if ($account->sort_code): ?><?= substr($account->sort_code,
0, 2) . "-" . substr($account->sort_code, 2, 2) . "-" . substr($account->sort_code, 4, 2) ?><?php else: ?>N/
A<?php endif; ?>
</p>
<p class="balances">
<strong>Total Balance:</strong> <?php if ($account->total_balance): ?><?= "£" .
number_format($account->total_balance) ?><?php else: ?>N/A<?php endif; ?>
<strong>Available Balance:</strong> <?php if ($account->available_balance): ?><?= "£" .
number_format($account->available_balance) ?><?php else: ?>N/A<?php endif; ?>
</p>
<p class="statements">
<?php if ($this->statements->count_by('account_id', $account->id)): ?>
<?= anchor('/statements/' . $account->id, 'View Statements') ?>
<?php else: ?>
Statements Not Currently Available
<?php endif; ?>
</p>
</div>
- 59. <div id="account">
<h1>
<?= $account->title() ?>
</h1>
<p class="information">
<strong>Name:</strong> <?= $account->name() ?><br />
<strong>Number:</strong> <?= $account->number() ?><br />
<strong>Sort Code:</strong> <?= $account->sort_code() ?>
</p>
<p class="balances">
<strong>Total Balance:</strong> <?= $account->total_balance() ?>
<strong>Available Balance:</strong> <?= $account->available_balance() ?>
</p>
<p class="statements">
<?= $account->statements_link() ?>
</p>
</div>
- 80. <header>
<h1>My Application</h1>
</header>
<div id="wrapper">
<?= $yield ?>
</div>
<footer>
<p>Copyright © 2012</p>
</footer>
- 82. Jamie Rumbelow
@jamierumbelow
jamieonsoftware.com
The CodeIgniter Handbook
codeigniterhandbook.com
Notes de l'éditeur
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n