PHP - Necesito ayuda con un codigo php

 
Vista:

Necesito ayuda con un codigo php

Publicado por Javier Herrera (2 intervenciones) el 28/07/2019 00:40:09
Hola a todos.
Tengo el siguiente codigo PHP, como puedo hacer para incrsutarlo en mi web con un codigo html y asi poder hacer un widget?

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
<? php
/ *
Nombre del complemento: Widget de grupo de la comunidad de Steam
URI del complemento: http://panotlet.tk/steam-group-widget/
Descripción: Muestra tu grupo como un widget!
Versión: 1.0.1
Autor: Paweł Otlewski
Autor URI: http://panotlet.tk/
* /
la clase  otletsg_widget  extiende  WP_Widget {
	función  __construir () {
		padre :: __construido (
			' otletsg_widget ' ,
			__ ( ' Steam Group ' , ' otletsg_widget_domain ' ),
			array ( ' description '  => __ ( ' Widget de Steam Group para mostrar un grupo de Steam ' , ' otletsg_widget_domain ' ),)
		);
	}
	 formulario de función  pública ( $ instancia ) {
		if ( isset ( $ instance [ ' title ' ])) {
			$ title  =  $ instance [ ' title ' ];
		}
		else {
			$ title  = __ ( ' Steam Group ' , ' otletsg_widget_domain ' );
		}
		if ( isset ( $ instance [ ' adress ' ])) {
			$ dirección  =  $ instancia [ ' dirección ' ];
		}
		else {
			$ adress  = __ ( ' http://example.com ' , ' otletsg_widget_domain ' );
		}
	? >
	< p >
	< label  for = " <? php echo $ this -> get_field_id ( ' title ' ); ? > "   > <? php _e ( ' Title: ' ); ? > </ label >
? >          " />
	</ p >
	< p >
	< Etiqueta  de = " <? Php? Echo $ this -> get_field_id ( ' dirección ' ); ? > "   > Dirección </ etiqueta >
? >          " />
	</ p >
	<? php
	}
	 widget de función  pública ( $ args , $ instance ) {
		$ title  = apply_filters ( ' widget_title ' , $ instance [ ' title ' ]);
		echo  $ args [ ' before_widget ' ];
		si ( !  vacio ( $ titulo ))
			echo  $ args [ ' before_title ' ] .  $ título  .  $ args [ ' after_title ' ];
		$ groupURL  = apply_filters ( ' widget_text ' , $ instance [ ' adress ' ]);
		$ xml  =  simplexml_load_file ( $ groupURL  .  '/ memberslistxml /' );
		eco  '
		<table>
			<tr>
				<th colspan = "2"> <img src = " ' . $ xml -> groupDetails -> avatarFull . ' " width = "100%"> </th>
			</tr>
			<tr>
				<td> Nombre del grupo </td>
				<td> ' . $ xml -> groupDetails -> groupName . ' </td>
			</tr>
			<tr>
				<td> Cuenta de miembros </td>
				<td> ' . $ xml -> groupDetails -> memberCount . ' </td>
			</tr>
			<tr>
				<td> En el juego </td>
				<td> ' . $ xml -> groupDetails -> membersInGame . ' </td>
			</tr>
			<tr>
				<td> en línea </td>
				<td> ' . $ xml -> groupDetails -> membersOnline . ' </td>
			</tr>
			<tr>
				<td colspan = "2"> <a href="  '$groupURL.' "> Mostrar este grupo </a> </ td>
			</tr>
		</table> ' ;
		echo  $ args [ ' after_widget ' ];
	}
	 actualización de la función  pública ( $ new_instance , $ old_instance ) {
		$ instance  =  array ();
		$ instance [ ' title ' ] = ( !  empty ( $ new_instance [ ' title ' ]))? strip_tags ( $ new_instance [ ' title ' ]): ' ' ;
		$ instancia [ ' dirección ' ] = ( !  empty ( $ new_instance [ ' dirección ' ]))? strip_tags ( $ new_instance [ ' dirección ' ]): ' ' ;
		devolver  $ instancia ;
		}
	}
	función  otletsg_load_widget () {
		register_widget ( ' otletsg_widget ' );
	}
	add_action ( ' widgets_init ' , ' otletsg_load_widget ' );
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 Mauro
Val: 2.761
Oro
Ha aumentado 1 puesto en PHP (en relación al último mes)
Gráfica de PHP

Necesito ayuda con un codigo php

Publicado por Mauro (1036 intervenciones) el 28/07/2019 21:27:34
Para empezar, no sé si será un error de copy & paste pero en todo caso, ten cuidado con las etiquetas de apertura y cierre de php (El <? y el php deben estar pegados).

Esto parece un plugin de WordPress. Si es así te sugiero que leas las instrucciones del sitio donde lo descargaste.
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