PHP - Cómo mostrar echo en <a href="#"> en php

 
Vista:
Imágen de perfil de Gilberto

Cómo mostrar echo en <a href="#"> en php

Publicado por Gilberto (6 intervenciones) el 20/03/2016 02:46:21
Hola Chicos del foro, sucede que llevo una semana sin resolver el calendario php que tengo en la web:
www.gs-instalaciones.com Al darle clic izquierda o derecha me mueve scroll, y quiero que permanezac estático, quiero ponerle <a href="#" >, y al mismo tiempo usar echo. Ayudeme, les agradecere mucho.

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
<?php
# definimos los valores iniciales para nuestro calendario
$month=date("n");
$year=date("Y");
$diaActual=date("j");
# Obtenemos el dia de la semana del primer dia
$meses=array(1=>"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio",
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
//definimos meses y años pasados, meses y años posteriores
if (!isset($_REQUEST["mes"])) $_REQUEST["mes"] = date("n");
if (!isset($_REQUEST["anio"])) $_REQUEST["anio"] = date("Y");
 
$month = $_REQUEST["mes"];
$year = $_REQUEST["anio"];
 
$prev_year = $year;
$next_year = $year;
$prev_month = $month-1;
$next_month = $month+1;
 
if ($prev_month == 0 ) {
    $prev_month = 12;
    $prev_year = $year - 1;
}
if ($next_month == 13 ) {
    $next_month = 1;
    $next_year = $year + 1;
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="utf-8">
	<script src="js/jquery-1.9.1.min.js"></script>
<script>
$(function(){ // document ready
 
           if (!!$('.sticky').offset()) { // make sure ".sticky" element exists
 
         var stickyTop = $('.sticky').offset().top; // returns number 
 
  $(window).scroll(function(){ // scroll event
 
  var windowTop = $(window).scrollTop(); // returns number 
 
  if (stickyTop < windowTop){
     $('.sticky').css({ top: 0});
  } else {
     $('.sticky').css('static');
  }
 
          });
 
        }
 
     });
</script>
</head>
	<body>
	<?php
	$previo=$_SERVER['PHP_SELF'].'?mes='. $prev_month.'&anio='.$prev_year;
	$next=$_SERVER["PHP_SELF"]."?mes=". $next_month."&anio=".$next_year;
	?>
<table id="fecha">
	<caption><a class="sticky" href="<?php echo $previo?>">
	<?php echo '<img src="imagen/right.jpg" align="left"/>';?></a>
	<a id="ancla2" href="<?php echo $next?>">
	<?php echo '<img src="imagen/left.jpg" align="right">';?></a>
	<?php echo $meses[$month].",  ".$year?>
	</caption>
	<tr>
		<th>Lun</th><th>Mar</th><th>Mie</th><th>Jue</th>
		<th>Vie</th><th>Sab</th><th class="dom">Dom</th>
	</tr>
	<tr bgcolor="#ececec">
		<?php
		# Devuelve 0 para domingo, 6 para sabado
		$diaSemana=date("w",mktime(0,0,0,$month,1,$year))+7;
		# Obtenemos el ultimo dia del mes
		$ultimoDiaMes=date("d",(mktime(0,0,0,$month+1,1,$year)-1));
		$last_cell=$diaSemana+$ultimoDiaMes;
		// hacemos un bucle hasta 43, que es el máximo de valores que puede
		// haber... 6 columnas de 7 dias
		for($i=1;$i<=43;$i++)
		{
			if($i==$diaSemana)
			{
				// determinamos en que dia empieza
				$day=1;
			}
			if($i<$diaSemana || $i>=$last_cell)
			{
				// celca vacia
				echo "<td> </td>";
			}else{
				// mostramos el dia
				if($day==$diaActual)
					echo "<td class='hoy'>$day</td>";
				else
					echo "<td>$day</td>";
				$day++;
			}
			// cuando llega al final de la semana, iniciamos una columna nueva
			if($i%7==0)
			{
				echo "</tr><tr>\n";
			}
		}
	?>
	</tr>
</table>
</body>
</html>
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

Cómo mostrar echo en <a href="#"> en php

Publicado por Jordi (33 intervenciones) el 20/03/2016 20:57:46
No acabo de entender lo que quieres hacer pero por lo que entiendo según el titulo del post seria algo así:

1
<a href="<?php echo "url.html"; ?>"><?php echo "Texto del enlace"; ?></a>
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
Imágen de perfil de Gilberto

Cómo mostrar echo en <a href="#"> en php

Publicado por Gilberto (6 intervenciones) el 21/03/2016 21:18:33
Gracias Jordi, hice mal mi pregunta. lo que quiero es que al hacer click en el link, el scroll sea estático. busque mantenerlo fijo con javascript, pero no me permitió. muchas gracias
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