Skip to content

Instantly share code, notes, and snippets.

View mpmont's full-sized avatar

Marco Monteiro mpmont

View GitHub Profile
@mpmont
mpmont / files.php
Created January 17, 2012 10:02
File Manager
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Files extends MY_Controller {
function __construct() {
parent::__construct();
//load dependecies
$this->load->model('admin/files_model');
}
@mpmont
mpmont / site.php
Created January 17, 2012 17:23
teste
$this->load->model('menus_model');
$language = $this->uri->segment(1);
switch ($language) {
case 'pt':
$this->lang->load('front-end', 'portuguese');
break;
case 'en':
$this->lang->load('front-end', 'english');
break;
@mpmont
mpmont / File.sublime-settings
Created January 17, 2012 18:59
sublimetest 2 settings
{
"theme": "Soda Dark.sublime-theme",
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"draw_white_space": "all",
"font_face": "Monaco",
"font_size": 13.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"match_brackets": true,
"match_brackets_angle": true,
@mpmont
mpmont / View.php
Created January 26, 2012 16:14
Rss
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<rss version="2.0">
<channel>
<title><?php echo $feed_name; ?></title>
<link><?php echo $feed_url; ?></link>
<description><?php echo $page_description; ?></description>
<lastBuildDate><?=date('D');?>, <?=date('d');?> <?=date('M');?> <?=date('Y');?> <?=date('G');?>:<?=date('i');?>:<?=date('s');?> <?=date('e');?></lastBuildDate>
<language><?php echo $page_language; ?></language>
<?php foreach ($posts as $post): ?>
<item>
@mpmont
mpmont / novo
Created February 8, 2012 21:41
novo
function GetArticles($options = array()) {
// QUALIFICATION
if (isset($options['idarticle']))
$this->db->where('idarticle', $options['idarticle']);
if (isset($options['idcategory']))
$this->db->where('idcategory', $options['idcategory']);
if (isset($options['articletitle']))
$this->db->where('articletitle', $options['articletitle']);
if (isset($options['articlestatus']))
SELECT TOP 10 *
FROM Doctor AS D, Doctor_Hospital AS DH, Hospital AS H
JOIN Doctor ON Doctor.DoctorId = Doctor_Hospital.DoctorId
JOIN Hospital ON Doctor_Hospital.HospitalId = Hospital.HospitalId
<select>
<?php foreach( $articles as $article): ?>
<option id="<?= article->id ?>"><?= $article->title ?></option>
<?php endforeach; ?>
</select>
@mpmont
mpmont / MY_Config.php
Created April 13, 2012 14:38
Linguagem
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Config extends CI_Config {
function site_url($uri = '')
{
if (is_array($uri))
{
$uri = implode('/', $uri);
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Name_model extends CI_Model {
public function insert( )
{
// This should be in a seperate file
$this->form_validation->set_rules('name', 'Name', 'trim|required|xss_clean');
if ( $this->form_validation->run() )
{
@mpmont
mpmont / New_MY_Model.php
Created April 24, 2012 15:46
Jamie My Model
//Now
/**
* Orders the result set by the criteria,
* using the same format as CI's AR library.
*
* @param mixed $criteria The criteria to order by
* @return void
* @since 1.1.2
*/