[eluser]Bl4cKWid0w[/eluser]
I'm using models to create a wiki. I get a php syntax error saying that it can't redeclare class Wiki on line 59. Line 59 is empty. I already made sure that all my if statements, etc were closed. Here is my code:
Code:
<?php
class Wiki extends Model {
var $title;
var $author;
var $date;
var $body;
var $lasteditby;
var $lastediton;
var $views;
var $categoryID;
function wiki(){
parent::Model();
}
function create($title, $author, $date, $body, $lasteditby, $lastediton, $categoryID){
$insert = array(
'title' => $title,
'author' => $author,
'date' => $date,
'body' => htmlentities($body),
'lasteditby' => $lasteditby,
'lastediton' => $lastediton,
'categoryID' => $categoryID
);
$query = $this->db->insert('wikis',$insert);
}
function get_new(){
$query = $this->db->query("SELECT * FROM wikis ORDER BY wikiID DESC LIMIT 5");
if($query->num_rows() == 0){
echo "<h1>There are no wiki's to display at this time</h1>";
} else {
foreach($query->result() as $wiki){
echo "<li>".anchor('http://www.unholydesigns.com/technicliche/wiki/article/'.$wiki->wikiID, $wiki->title)."</li>";
}
}
}
function get_popular(){
$query = $this->db->query("SELECT * FROM wikiws ORDER BY views");
if($query->num_rows() == 0){
echo "<h1>There are no wiki's to display at this time</h1>";
} else {
foreach($query->result() as $wiki){
echo "<li>".anchor('http://www.unholydesigns.com/technicliche/wiki/article/'.$wiki->wikiID, $wiki->title)."</li>";
}
}
}
}