From eadfd21d976d333387d966b6e30101a0d15f1627 Mon Sep 17 00:00:00 2001 From: pecesama Date: Thu, 5 Apr 2007 00:54:47 +0000 Subject: [PATCH] Single pages :) --- classes/gelato.class.php | 5 +++ index.php | 64 ++++++++++++++++++++++++++++--- themes/tumblr/template_header.htm | 2 +- 3 files changed, 64 insertions(+), 7 deletions(-) diff --git a/classes/gelato.class.php b/classes/gelato.class.php index b71d79a..38d929c 100644 --- a/classes/gelato.class.php +++ b/classes/gelato.class.php @@ -50,6 +50,11 @@ class gelato extends Conexion_Mysql { return $this->mid_consulta; } + function getPost($id="") { + $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); + return mysql_fetch_array($this->mid_consulta); + } + function getType($id) { if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { if ($this->contarRegistros()>0) { diff --git a/index.php b/index.php index 3ae1bec..4d7a59f 100644 --- a/index.php +++ b/index.php @@ -24,8 +24,10 @@ if (isset($_GET["post"])) { $id_post = $_GET["post"]; - } else { - $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null; + } else { + if (isset($param_url[1]) && $param_url[1]=="post") { + $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null; + } } $input = array("{Title}", "{Description}", "{URL_Tumble}"); @@ -109,11 +111,61 @@ $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error"); } } else { - /* - $row = $tumble->obtenerArticulo($id_post); + $register = $tumble->getPost($id_post); - */ - + $formatedDate = date("M d", strtotime($register["date"])); + $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/"; + switch ($tumble->getType($register["id_post"])) { + case "1": + $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_regular_post"); + $template->mostrarPlantilla(); + break; + case "2": + $input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $register["url"], "", $register["description"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_photo"); + $template->mostrarPlantilla(); + break; + case "3": + $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_quote"); + $template->mostrarPlantilla(); + break; + case "4": + $input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_url"); + $template->mostrarPlantilla(); + break; + case "5": + $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_conversation"); + $template->mostrarPlantilla(); + break; + case "6": + $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_video"); + $template->mostrarPlantilla(); + break; + case "7": + $input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); + $output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); + + $template->cargarPlantilla($input, $output, "template_mp3"); + $template->mostrarPlantilla(); + break; + } } $input = array("{URL_Tumble}"); diff --git a/themes/tumblr/template_header.htm b/themes/tumblr/template_header.htm index b562636..8a45858 100644 --- a/themes/tumblr/template_header.htm +++ b/themes/tumblr/template_header.htm @@ -18,7 +18,7 @@
RSS -

{Title}

+

{Title}

{Description}