Browse Source

Single pages :)

pecesama 18 years ago
parent
commit
eadfd21d97
3 changed files with 64 additions and 7 deletions
  1. 5 0
      classes/gelato.class.php
  2. 58 6
      index.php
  3. 1 1
      themes/tumblr/template_header.htm

+ 5 - 0
classes/gelato.class.php View File

@@ -50,6 +50,11 @@ class gelato extends Conexion_Mysql {
50 50
 		return $this->mid_consulta;
51 51
 	}
52 52
 	
53
+	function getPost($id="") {
54
+		$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
55
+		return mysql_fetch_array($this->mid_consulta);
56
+	}
57
+	
53 58
 	function getType($id) {
54 59
 		if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {	
55 60
 			if ($this->contarRegistros()>0) {	

+ 58 - 6
index.php View File

@@ -24,8 +24,10 @@
24 24
 	
25 25
 	if (isset($_GET["post"])) {
26 26
 		$id_post = $_GET["post"];
27
-	} else {		
28
-		$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
27
+	} else {
28
+		if (isset($param_url[1]) && $param_url[1]=="post") {
29
+			$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
30
+		}
29 31
 	}
30 32
 	
31 33
 	$input = array("{Title}", "{Description}", "{URL_Tumble}");
@@ -109,11 +111,61 @@
109 111
 			$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
110 112
 		}
111 113
 	} else {
112
-		/*
113
-		$row = $tumble->obtenerArticulo($id_post);
114
+		$register = $tumble->getPost($id_post);
114 115
 		
115
-		*/
116
-
116
+		$formatedDate = date("M d", strtotime($register["date"]));
117
+		$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
118
+		switch ($tumble->getType($register["id_post"])) {
119
+			case "1":
120
+				$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
121
+				$output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
122
+									
123
+				$template->cargarPlantilla($input, $output, "template_regular_post");
124
+				$template->mostrarPlantilla();
125
+				break;
126
+			case "2":
127
+				$input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{URL_Tumble}");
128
+				$output = array($formatedDate, $permalink, $register["url"], "", $register["description"], $conf->urlGelato);
129
+				
130
+				$template->cargarPlantilla($input, $output, "template_photo");
131
+				$template->mostrarPlantilla();							   
132
+				break;
133
+			case "3":
134
+				$input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
135
+				$output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
136
+				
137
+				$template->cargarPlantilla($input, $output, "template_quote");
138
+				$template->mostrarPlantilla();
139
+				break;
140
+			case "4":
141
+				$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
142
+				$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
143
+				
144
+				$template->cargarPlantilla($input, $output, "template_url");
145
+				$template->mostrarPlantilla();
146
+				break;
147
+			case "5":
148
+				$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
149
+				$output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
150
+				
151
+				$template->cargarPlantilla($input, $output, "template_conversation");
152
+				$template->mostrarPlantilla();
153
+				break;
154
+			case "6":
155
+				$input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
156
+				$output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
157
+				
158
+				$template->cargarPlantilla($input, $output, "template_video");
159
+				$template->mostrarPlantilla();
160
+				break;
161
+			case "7":
162
+				$input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
163
+				$output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
164
+				
165
+				$template->cargarPlantilla($input, $output, "template_mp3");
166
+				$template->mostrarPlantilla();
167
+				break;
168
+		}
117 169
 	}
118 170
 	
119 171
 	$input = array("{URL_Tumble}");

+ 1 - 1
themes/tumblr/template_header.htm View File

@@ -18,7 +18,7 @@
18 18
     <div id="container">
19 19
         <a href="{URL_Tumble}/rss.php"><img src="{URL_Tumble}/themes/tumblr/img/rss.gif" id="rss" alt="RSS"></a>
20 20
 
21
-        <h1><a href="/">{Title}</a></h1>        
21
+        <h1><a href="{URL_Tumble}/">{Title}</a></h1>        
22 22
         
23 23
             <div id="description">
24 24
                 {Description}