Skip to content

Instantly share code, notes, and snippets.

@akuzemchak
Created November 26, 2011 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akuzemchak/1395774 to your computer and use it in GitHub Desktop.
Save akuzemchak/1395774 to your computer and use it in GitHub Desktop.
Y'ALL Partials
<?php
class Auth extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->spark('yall/0.2.0'); // not needed if autoloaded
}
public function login()
{
// your auth logic goes here...
$this->yall->set('title', 'Login') // $title in layout file
->partial('content', 'login') // $content in layout file
->render();
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title><?php echo $title ?></title>
<link rel="stylesheet" href="screen.css" />
</head>
<body>
<h1>My App Name</h1>
<ul id="main-nav">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
<div id="main-content">
<h2><?php echo $title ?></h2>
<?php echo $content ?>
</div>
<div id="footer">
&copy; Your Company Name.
</div>
</body>
</html>
<?php echo form_open() ?>
<div>
<?php echo form_label('email', 'Email address') ?>
<?php echo form_input('email') ?>
</div>
<div>
<?php echo form_label('password', 'Password') ?>
<?php echo form_password('password') ?>
</div>
<div>
<input type="submit" value="Login" />
</div>
<?php echo form_close() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment