PHP - Ayuda Full Callender

 
Vista:
sin imagen de perfil
Val: 35
Ha aumentado su posición en 3 puestos en PHP (en relación al último mes)
Gráfica de PHP

Ayuda Full Callender

Publicado por Ramiro (20 intervenciones) el 21/09/2017 23:50:03
Hola gente soy nuevo en este foro y también en cuanto a la programación, tengo una duda y no se como hacer. El caso es de que quiero traer registros de la base de datos a jquery a este codigo:

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
$(document).ready(function() {
 
	$('#calendar').fullCalendar({
		header: {
			left: 'prev,next today',
			center: 'title',
			right: 'month,agendaWeek,agendaDay,listWeek'
		},
		defaultDate: '2017-09-12',
		navLinks: true, // can click day/week names to navigate views
		editable: true,
		eventLimit: true, // allow "more" link when too many events
		events: [
			{
				title: 'All Day Event',
				start: '2017-09-01',
			},
			{
				title: 'Long Event',
				start: '2017-09-07',
				end: '2017-09-10'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2017-09-09T16:00:00'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2017-09-16T16:00:00'
			},
			{
				title: 'Conference',
				start: '2017-09-11',
				end: '2017-09-13'
			},
			{
				title: 'Meeting',
				start: '2017-09-12T10:30:00',
				end: '2017-09-12T12:30:00'
			},
			{
				title: 'Lunch',
				start: '2017-09-12T12:00:00'
			},
			{
				title: 'Meeting',
				start: '2017-09-12T14:30:00'
			},
			{
				title: 'Happy Hour',
				start: '2017-09-12T17:30:00'
			},
			{
				title: 'Dinner',
				start: '2017-09-12T20:00:00'
			},
			{
				title: 'Birthday Party',
				start: '2017-09-13T07:00:00'
			},
			{
				title: 'Click for Google',
				url: 'http://google.com/',
				start: '2017-09-28'
			}
		]
	});
 
});
Quiero traer las fechas que tengo en la base de datos y ponerlos en start y end. Alguien me podria ayudar decirme como puedo hacer.
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 santi
Val: 588
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Ayuda Full Callender

Publicado por santi (204 intervenciones) el 22/09/2017 11:56:17
Hola,

puedes añadir código php dentro de jQuery:

1
2
3
4
5
6
7
8
9
10
11
12
13
<script>
$(function(){
...
<?php foreach($contenido as $content): ?>
{
    title: '<?php echo $cotnent->title ?>',
    start: '<?php echo $cotnent->start ?>',
    end: '<?php echo $cotnent->end ?>'
},
<?php endforeach; ?>
...
});
</script>

O también en tu constructor puedes añadir este mismo script y añadirlo en una función entonces lo único que tienes que hacer es llamar a esta función pasando los parámetros.

Espero que te sirva ;)
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
2
Comentar
sin imagen de perfil
Val: 35
Ha aumentado su posición en 3 puestos en PHP (en relación al último mes)
Gráfica de PHP

Ayuda Full Callender

Publicado por Ramiro (20 intervenciones) el 01/10/2017 15:51:42
Disculpa es que soy nuevo en esto el código le tendría que poner así?. Ademas en $contenido y $content que van?
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
<?php foreach($contenido as $content): ?>
{
    title: '<?php echo $cotnent->title ?>',
    start: '<?php echo $cotnent->start ?>',
    end: '<?php echo $cotnent->end ?>'
},
<?php endforeach; ?>
 
$(document).ready(function() {
 
	$('#calendar').fullCalendar({
		header: {
			left: 'prev,next today',
			center: 'title',
			right: 'month,agendaWeek,agendaDay,listWeek'
		},
		defaultDate: '2017-09-12',
		navLinks: true, // can click day/week names to navigate views
		editable: true,
		eventLimit: true, // allow "more" link when too many events
		events: [
			{
				title: 'All Day Event',
				start: '2017-09-01',
			},
			{
				title: 'Long Event',
				start: '2017-09-07',
				end: '2017-09-10'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2017-09-09T16:00:00'
			},
			{
				id: 999,
				title: 'Repeating Event',
				start: '2017-09-16T16:00:00'
			},
			{
				title: 'Conference',
				start: '2017-09-11',
				end: '2017-09-13'
			},
			{
				title: 'Meeting',
				start: '2017-09-12T10:30:00',
				end: '2017-09-12T12:30:00'
			},
			{
				title: 'Lunch',
				start: '2017-09-12T12:00:00'
			},
			{
				title: 'Meeting',
				start: '2017-09-12T14:30:00'
			},
			{
				title: 'Happy Hour',
				start: '2017-09-12T17:30:00'
			},
			{
				title: 'Dinner',
				start: '2017-09-12T20:00:00'
			},
			{
				title: 'Birthday Party',
				start: '2017-09-13T07:00:00'
			},
			{
				title: 'Click for Google',
				url: 'http://google.com/',
				start: '2017-09-28'
			}
		]
	});
 
});
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