Created
April 10, 2012 10:29
-
-
Save mpmont/2350195 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select> | |
<?php foreach( $articles as $article): ?> | |
<option id="<?= article->id ?>"><?= $article->title ?></option> | |
<?php endforeach; ?> | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Articles extends CI_Model { | |
public function GetAll() | |
{ | |
$query = $this->db->get('articles'); | |
return $query->result(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Controllername extends CI_Controller { | |
public function index() | |
{ | |
$this->load->model('articles_model', 'article'); | |
$data['articles'] = $this->article->GetAll(); | |
$this->load->view('articles_list'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment