PHP - leer mas

 
Vista:
sin imagen de perfil
Val: 557
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

leer mas

Publicado por zendi (1056 intervenciones) el 08/05/2014 17:31:19
tengo este codigo que imprime un texto y lo corta:
1
2
3
4
5
6
7
8
9
10
11
<?php echo Conectar::corta_palabra($datos[$i]["detalle"],150);?>...
</div>
<div id="separador_texto_debajo"></div>
<div id="debajo_post">
    <div id="leer_mas">
    <?php
 
    ?>
        <a href="<?php echo $texto."p".$datos[$i]["detalle"].".html" ?>">Leer m&aacute;s</a>
    </div>
    <div id="comentarios">Tiene <?php echo $tra->total_comentarios($datos[$i]["id_noticia"]);?> Comentarios</div>
La idea es que cuando yo cliquee aparezca el texto que falta por leer.
Como haria para traer lo queda del texto?
Si pudieran comentar y disculpen.
Nota: solo estoy enviandoles un trozo de codigo.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

leer mas

Publicado por xve (6935 intervenciones) el 08/05/2014 20:42:54
Hola Zendi, una manera que podrías hacer, es no cortar el código, pero si definir una altura fija para el div que lo contiene, dejando que el resto quede oculto detrás del div. De esta manera cuando quieras, simplemente tienes que eliminar el limite de altura del div para visualizar el contenido entero.

te puede servir?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 557
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

leer mas

Publicado por zendi (1056 intervenciones) el 09/05/2014 01:18:26
Que tal xve, Te envio el codigo completo a ver si me explicas mejor ya que no logro entenderte bien:

este es el codigo de la funcion:
1
2
3
4
5
6
7
8
9
10
11
public function get_noticias($id_noticia)
	{
		$noticias ="SELECT detalle FROM noticias";
		$res1=@pg_query(Conectar::con(),$noticias);
    	if($reg1=@pg_fetch_array($res1))
		{
			$detalle=$reg1["detalle"];
		}
			return $detalle;
 
	}

y este es el codigo que recibe la funcion:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
require_once("classblog.php");
$tra=new Trabajo();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"/>
 
 
<title>..::Blog de Alejandro::..</title>
<link href="css/estilos.css" type="text/css" rel="stylesheet"/>
</head>
 
<body>
 <center>
<div id="principal">
  <div id="header">header</div>
	<div id="main">
		<div id="menu">
			<?php include("menublog.php");?>
			<div id="buscador">
				<form name="buscar">
 
				<input type="text" name="s">
				<a href=""><img src="img/buscador.GIF" border="0" width="16" height="16" border="0" width="16" height="16"></a>
 
				</form>
 
			</div>
		</div>
    	</div>
		<div id="content">
 
			<div id="contenedor">
 
				<?php
				if (isset($_GET["pos"]))
				{
					$inicio=$_GET["pos"];
				}
				else
				{
					$inicio=0;
				}
				if(isset($_GET["cat"]))
				{
					$c=$_GET["cat"];
				}else
				{
					$c=1;
				}
				$datos=$tra->get_paginacion_noticias($inicio,$c);
    		if (count($datos)==0)
			{
				echo "<h1>No hay registros asociados a esta categoría</h1>";
			}else
			{
				for($i=0;$i<count($datos);$i++)
				{
				?>
				<div id="separador_post">
 
 
				</div>
				<div id="post">
					<div id="titulo_post">
						<div id="titulo"><?php echo $datos[$i]["titulo"];?></div>
						<div id="fecha"><?php echo $datos[$i]["fecha_cadena"];?></div>
					</div>
					<div id="texto_post">
					<hr>
					<?php echo Conectar::corta_palabra($datos[$i]["detalle"],150);?>...
					</div>
					<div id="separador_texto_debajo"></div>
					<div id="debajo_post">
						<div id="leer_mas">
						<?php
						$texto=str_replace(" ","-",$datos[$i]["titulo"]);
						//echo $texto;
						?>
						<?php $datos1=$tra->get_noticias($noticia);?>
 
							<a href="<?php echo $datos1[$i]["detalle"]?>">Leer m&aacute;s</a>
 
 
						</div>
 
						<div id="comentarios">Tiene <?php echo $tra->total_comentarios($datos[$i]["id_noticia"]);?> Comentarios</div>
					</div>
 
				</div>
 
				<div id="div_entre_post"></div>
				<?php
				}
				}
				?>
				<div id="div_paginacion_post">
				<hr>
				<?php
				if($inicio==0)
				{
				?>
				Anteriores Publicaciones
				<?php
				}else
				{
				$anterior=$inicio-10;
				?>
				<a href="?pos=<?php echo $anterior;?>&cat=<?php echo $c;?>" title="Anteriores Publicaciones">Anteriores Publicaciones</a>
				<?php
				}
				?>
 
				&nbsp;&nbsp;||&nbsp;&nbsp;
				<?php
				if(count($datos)==10)
				{
					$proximo=$inicio+10;
					?>
					<a href="?pos=<?php echo $proximo;?>&cat=<?php echo $c;?>" title="Siguientes Publicaciones">Siguientes Publicaciones</a>
					<?php
				}else
				{
				    ?>
      				Siguientes Publicaciones
    				<?php
				}
				?>
				</div>
			</div>
 
 
			<div id="sidebar">
				<div id="separador_widget"></div>
				<div id="widget">
 
						<div id="caja_widget">
							<div id="titulo_widget">Categorias</div>
						<?php
						$categoria=$tra->get_categorias();
						 for($i=0;$i<count($categoria);$i++)
						 {
						?>
							<div id="contenido_widget">
							<a href="?cat=<?php echo $categoria[$i]["id_categoria"];?>" title="<?php echo $categoria[$i]["categoria"];?>"><?php echo $categoria[$i]["categoria"];?></a>
							</div>
						<?php
 						 }
						?>
						</div>
 
					<div class="separador_lateral_widget"></div>
				</div>
 
				<div id="separador_widget"></div>
				<div id="widget">
 
						<div id="caja_widget">
							<div id="titulo_widget">Ultimos VideosTutoriales</div>
						<?php
						 for($i=0;$i<10;$i++)
						 {
						?>
							<div id="contenido_widget">PHP</div>
						<?php
 						 }
						?>
						</div>
 
					<div class="separador_lateral_widget"></div>
				</div>
 
 
 
			</div>
			<div id="footer"></div>
			<div id="footer">
			<hr>
			&copy; Desarrollado por Alejandro Cuello 2012 - <?php echo date("Y");?>
			<hr>
			</div>
  </div>
</div>
 </center>
 
</body>
</html>
y por el otro lado esta el estilo:
con el div en negrita
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* desarrollado por  */
body{ margin-left:0px; margin-top:0px; font-family: arial;}
 
#principal{ width:800px; font-size:12px}
 
	#header{ width:800px; height:100px; background-color:#FF0000; color:#FFFFFF; float:left}
	#main{ width:800px; height:%100; float:left;}
		#menu{ width:800px; height:25px; float:left;}
			.boton{ width:120px; height:25px; float:left; background-color:#000000; color:#FFFFFF;}
			.url_boton{ text-decoration:none; color:#FFFFFF;}
			#buscador{ width:200px; height:25px; float:left; text-align:center}
 
 
		#content{ width:800px; float:left;}
			#contenedor{ width:600px; float:left;}
 
				#separador_post{ width:600px; height:20px; float:left}
				#post{ width:600px; float:left; text-align:center}
					#titulo_post{ width:600px; height:20px; float:left}
						#titulo{ width:400px; height:20px; float:left; text-align:left; font-weight:bold}
						#fecha{ width:200px; height:20px; float:left; text-align:right}
					#texto_post{ width:600px; float:left; text-align:left}
					#separador_texto_debajo{ width:600px; height:10px; float:left}
					#debajo_post{ width:600px; height:20px; float:left}
[b]						#leer_mas{ width:400px; height:20px; float:left; text-align:left}
						#comentarios{ width:200px; height:20px; float:left; text-align:right}
					#div_entre_post{ width:600px; height:5px; float:left; background-color:#000000}
					#div_paginacion_post{ width:600px; height:25px; float:left; text-align:center}
 
					/**************estilos para noticias.php*************************/
					#div_post_top{width:600px; height:25px;float:left }
						#div_post_contenedor{ width:600px; float:left}
    					#div_post_titulo{ width:600px; height:20px; float:left; text-align:left; font-weight:bold }
							#div_post_titulo_texto{ width:400px; height:20px; float:left; text-align:left; font-weight: bold; font-size:14px }					
								#div_post_titulo_fecha{ width:200px; height:20px; float:left; text-align:right }
						#div_post_separdor_debajo_titulo{ width:600px; height:5px; float:left; background:#000000}
						#div_post_contenedor_detalle{ width:600px; float:left}
						 .div_separador_detalle_post{ width:25px; float:left;}
						 #div_detalle_post{ width:550px; float:left; margin-left:25px; margin-left:25px}
 
						 	#div_contenedor_categoria_y_descarga_post{ width:550px; height:48px; float:left}
 
								#div_categoria_post{ width:275px; height:20px; float:left; text-align:left}
								#div_descarga_post{ width:275px; height:48px; float:left; text-align:right}
						    #div_form_comentarios{ width:550px; float:left; text-align:left }
							#div_comentarios_post{width:550px; float:left; text-align:left}
/*						 #div_detalle_separador_debajo_post{ width:550px; height:3px; float:left; background:009966;}
*/
			#sidebar{ width:200px; float:left}
				#separador_widget{ width:200px; height:20px; float:left}
				#widget{ width:200px; float:left; margin-left:15px}
					.separador_lateral_widget{ width:15px; float:left}
					#caja_widget{ width:170px; float:left}
						#titulo_widget{ width:170px; height:20px; float:left; text-align:center; background-color:#333333; color:#FFFFFF}
						#contenido_widget{ width:170px; height:20px; float:left; background-color:#F0F0F0; text-align:left}
			#footer{ width:800px; height:20px; float:left; text-align:center}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar