Foros del Web » Programando para Internet » PHP »

Metatag modificado hace...

Estas en el tema de Metatag modificado hace... en el foro de PHP en Foros del Web. Buenas tardes, tengo este código para añadirle a mi header para que la caché sepa si ha sido modificado o no mi contenido, pero este ...
  #1 (permalink)  
Antiguo 26/07/2015, 14:08
(Desactivado)
 
Fecha de Ingreso: julio-2015
Mensajes: 5
Antigüedad: 8 años, 9 meses
Puntos: 0
Metatag modificado hace...

Buenas tardes,

tengo este código para añadirle a mi header para que la caché sepa si ha sido modificado o no mi contenido, pero este código así metido me da error.

echo '<meta http-equiv="If-Modified-Since" content="'.gmdate("D, d M Y H:i:s").'GMT" />';

Alguien me podría ayudar a saber que falla o que tengo que añadir para poder decirle a google si este artículo tiene modificaciones o no?

Gracias
  #2 (permalink)  
Antiguo 26/07/2015, 17:10
Avatar de Patriarka  
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 3 meses
Puntos: 288
Respuesta: Metatag modificado hace...

y cual es el error?
  #3 (permalink)  
Antiguo 26/07/2015, 23:47
(Desactivado)
 
Fecha de Ingreso: julio-2015
Mensajes: 5
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Metatag modificado hace...

Pues el echo me aparece como texto en mi web.

Creo que tengo que añadir algo más a este código pero como no se php pues no se que tengo que hacer.


Gracias
  #4 (permalink)  
Antiguo 27/07/2015, 03:33
(Desactivado)
 
Fecha de Ingreso: julio-2015
Mensajes: 5
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Metatag modificado hace...

Cita:
Iniciado por Patriarka Ver Mensaje
y cual es el error?
Pues el echo me aparece como texto en mi web.

Creo que tengo que añadir algo más a este código pero como no se php pues no se que tengo que hacer.


Gracias
  #5 (permalink)  
Antiguo 27/07/2015, 05:44
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Metatag modificado hace...

primero debes dar mas informacion sobre el codigo no solo esa linea, eso porque si estas metiewndola tal como esta dentro de html sin crear las etiquetas php se va a ver como texto en tu pagina eso es logico, asi que muestra el codigo completo para ver que es lo que tienes, aunque ya te dije que te esta pasando alli.

Código PHP:
Ver original
  1. echo "<meta http-equiv='If-Modified-Since' content='".gmdate('D, d M Y H:i:s')."'GMT' />";
mira las comillas, debes estar muy pendiente de eso
__________________
[email protected]
HITCEL
  #6 (permalink)  
Antiguo 27/07/2015, 09:35
 
Fecha de Ingreso: julio-2015
Mensajes: 54
Antigüedad: 8 años, 9 meses
Puntos: 1
Respuesta: Metatag modificado hace...

Cita:
Iniciado por xfxstudios Ver Mensaje
primero debes dar mas informacion sobre el codigo no solo esa linea, eso porque si estas metiewndola tal como esta dentro de html sin crear las etiquetas php se va a ver como texto en tu pagina eso es logico, asi que muestra el codigo completo para ver que es lo que tienes, aunque ya te dije que te esta pasando alli.

Código PHP:
Ver original
  1. echo "<meta http-equiv='If-Modified-Since' content='".gmdate('D, d M Y H:i:s')."'GMT' />";
mira las comillas, debes estar muy pendiente de eso
Yo tengo ese problema

Con las etiquetas php lo que sucede es que en el código de página esto queda en color rojo. Imagino que es por que hay algo mal en el código.

<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="Rockin" />


<?php
echo "<meta http-equiv='If-Modified-Since' content='".gmdate('D, d M Y H:i:s')."'GMT' />";
?>
  #7 (permalink)  
Antiguo 27/07/2015, 10:32
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Metatag modificado hace...

muestra todo el codigo de la pagina para poder ayudarte mejor
__________________
[email protected]
HITCEL
  #8 (permalink)  
Antiguo 27/07/2015, 12:02
 
Fecha de Ingreso: julio-2015
Mensajes: 54
Antigüedad: 8 años, 9 meses
Puntos: 1
Respuesta: Metatag modificado hace...

Cita:
Iniciado por xfxstudios Ver Mensaje
muestra todo el codigo de la pagina para poder ayudarte mejor
<!DOCTYPE html>

<!--[if (gte IE 9)|!(IE)]><!--><html <?php language_attributes(); ?>> <!--<![endif]-->
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>

<head>



<!-- Metatags
================================================== ======= -->

<meta property="og:title" content="<?php the_title(); ?>"/>
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt()); ?>" />
<?php
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image="https://www.rock.com/img/rock.png"; //replace this with a default image on your server or an image in your media library
echo '<meta property="og:image" content="' . $default_image . '"/>';
}
else{
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'medium' );
echo '<meta property="og:image" content="' . esc_attr( $thumbnail_src[0] ) . '"/>';
}
echo "
"; ?>
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="Prot-On" />


<?php
echo "<meta http-equiv='If-Modified-Since' content='".gmdate('D, d M Y H:i:s')."'GMT' />";
?>

<!-- Favicon

================================================== -->
<link rel="shortcut icon" href="https://www.rock.com/img/favicon.ico"/>


<?php wp_head(); ?>

<!-- Localizacion
================================================== -->
<script type="text/javascript">
if(top.location!=this.location) top.location=this.location;
</script>



<!-- WordPress Stuff
================================================== ======= -->
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

<?php wp_head(); ?>

</head>

<body <?php body_class(); ?>>

<?php if($data['select_layoutstyle'] == 'Boxed Layout' || $data['select_layoutstyle'] == 'Boxed Layout with margin' ) { ?>
<div id="boxed-layout">
<?php } ?>

<div class="wrapall">

<?php if($data['check_topbar'] == true) { ?>
<div id="topbar" class="clearfix <?php if($data['check_socialtopbar'] == false) { echo 'no-social'; } ?>">

<div class="container">
<div class="lang"><?php icl_post_languages(); ?></div>

<?php } ?>
</div>

<?php if($data['check_socialtopbar'] == true) { ?>
<div class="eight columns mr-30-perc">
<div class="social-icons clearfix">
<ul>
<?php if($data['social_twitter'] != "") { ?>
<li class="social-twitter"><a href="http://www.twitter.com/<?php echo $data['social_twitter']; ?>" target="_blank" title="<?php _e( 'Twitter', 'minti' ) ?>"><?php _e( 'Twitter', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_forrst'] != "") { ?>
<li class="social-forrst"><a href="<?php echo $data['social_forrst']; ?>" target="_blank" title="<?php _e( 'Forrst', 'minti' ) ?>"><?php _e( 'Forrst', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_dribbble'] != "") { ?>
<li class="social-dribbble"><a href="<?php echo $data['social_dribbble']; ?>" target="_blank" title="<?php _e( 'Dribbble', 'minti' ) ?>"><?php _e( 'Dribbble', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_flickr'] != "") { ?>
<li class="social-flickr"><a href="<?php echo $data['social_flickr']; ?>" target="_blank" title="<?php _e( 'Flickr', 'minti' ) ?>"><?php _e( 'Flickr', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_facebook'] != "") { ?>
<li class="social-facebook"><a href="<?php echo $data['social_facebook']; ?>" target="_blank" title="<?php _e( 'Facebook', 'minti' ) ?>"><?php _e( 'Facebook', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_skype'] != "") { ?>
<li class="social-skype"><a href="<?php echo $data['social_skype']; ?>" target="_blank" title="<?php _e( 'Skype', 'minti' ) ?>"><?php _e( 'Skype', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_digg'] != "") { ?>
<li class="social-digg"><a href="<?php echo $data['social_digg']; ?>" target="_blank" title="<?php _e( 'Digg', 'minti' ) ?>"><?php _e( 'Digg', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_google'] != "") { ?>
<li class="social-google"><a href="<?php echo $data['social_google']; ?>" target="_blank" title="<?php _e( 'Google', 'minti' ) ?>"><?php _e( 'Google+', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_instagram'] != "") { ?>
<li class="social-instagram"><a href="<?php echo $data['social_instagram']; ?>" target="_blank" title="<?php _e( 'Instagram', 'minti' ) ?>"><?php _e( 'Instagram', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_linkedin'] != "") { ?>
<li class="social-linkedin"><a href="<?php echo $data['social_linkedin']; ?>" target="_blank" title="<?php _e( 'LinkedIn', 'minti' ) ?>"><?php _e( 'LinkedIn', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_vimeo'] != "") { ?>
<li class="social-vimeo"><a href="<?php echo $data['social_vimeo']; ?>" target="_blank" title="<?php _e( 'Vimeo', 'minti' ) ?>"><?php _e( 'Vimeo', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_yahoo'] != "") { ?>
<li class="social-yahoo"><a href="<?php echo $data['social_yahoo']; ?>" target="_blank" title="<?php _e( 'Yahoo', 'minti' ) ?>"><?php _e( 'Yahoo', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_tumblr'] != "") { ?>
<li class="social-tumblr"><a href="<?php echo $data['social_tumblr']; ?>" target="_blank" title="<?php _e( 'Tumblr', 'minti' ) ?>"><?php _e( 'Tumblr', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_youtube'] != "") { ?>
<li class="social-youtube"><a href="<?php echo $data['social_youtube']; ?>" target="_blank" title="<?php _e( 'YouTube', 'minti' ) ?>"><?php _e( 'YouTube', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_picasa'] != "") { ?>
<li class="social-picasa"><a href="<?php echo $data['social_picasa']; ?>" target="_blank" title="<?php _e( 'Picasa', 'minti' ) ?>"><?php _e( 'Picasa', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_deviantart'] != "") { ?>
<li class="social-deviantart"><a href="<?php echo $data['social_deviantart']; ?>" target="_blank" title="<?php _e( 'DeviantArt', 'minti' ) ?>"><?php _e( 'DeviantArt', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_behance'] != "") { ?>
<li class="social-behance"><a href="<?php echo $data['social_behance']; ?>" target="_blank" title="<?php _e( 'Behance', 'minti' ) ?>"><?php _e( 'Behance', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_pinterest'] != "") { ?>
<li class="social-pinterest"><a href="<?php echo $data['social_pinterest']; ?>" target="_blank" title="<?php _e( 'Pinterest', 'minti' ) ?>"><?php _e( 'Pinterest', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_paypal'] != "") { ?>
<li class="social-paypal"><a href="<?php echo $data['social_paypal']; ?>" target="_blank" title="<?php _e( 'PayPal', 'minti' ) ?>"><?php _e( 'PayPal', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_delicious'] != "") { ?>
<li class="social-delicious"><a href="<?php echo $data['social_delicious']; ?>" target="_blank" title="<?php _e( 'Delicious', 'minti' ) ?>"><?php _e( 'Delicious', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_xing'] != "") { ?>
<li class="social-xing"><a href="<?php echo $data['social_xing']; ?>" target="_blank" title="<?php _e( 'XING', 'minti' ) ?>"><?php _e( 'XING', 'minti' ) ?></a></li>
<?php } ?>
<?php if($data['social_rss'] == true) { ?>
<li class="social-rss"><a href="<?php bloginfo('rss2_url'); ?>" target="_blank" title="<?php _e( 'RSS', 'minti' ) ?>"><?php _e( 'RSS', 'minti' ) ?></a></li>
<?php } ?>
</ul>
</div>
</div>
<?php } ?>

</div>

</div> <!-- end topbar -->
<?php } ?>

<?php

if($data['header_layout']) {
if(is_page('header-2')) {
include_once('framework/inc/headers/header-v2.php');
} elseif(is_page('header-3')) {
include_once('framework/inc/headers/header-v3.php');
} elseif(is_page('header-4')) {
include_once('framework/inc/headers/header-v4.php');
} elseif(is_page('header-5')) {
include_once('framework/inc/headers/header-v5.php');
} elseif(is_page('header-6')) {
include_once('framework/inc/headers/header-v6.php');
} else {
include_once('framework/inc/headers/header-'.$data['header_layout'].'.php');
}
} else {
if(is_page('header-2')) {
include_once('framework/inc/headers/header-v2.php');
} elseif(is_page('header-3')) {
include_once('framework/inc/headers/header-v3.php');
} elseif(is_page('header-4')) {
include_once('framework/inc/headers/header-v4.php');
} elseif(is_page('header-5')) {
include_once('framework/inc/headers/header-v5.php');
} elseif(is_page('header-6')) {
include_once('framework/inc/headers/header-v6.php');
} else {
include_once('framework/inc/headers/header-v1.php');
}
}

?>
  #9 (permalink)  
Antiguo 27/07/2015, 13:15
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Metatag modificado hace...

segun el codigo este esta de mas:

Código PHP:
Ver original
  1. </div> <!-- end topbar -->
  2. <?php } ?>//elimina este de aqui

tienes dos paginas alli o que?, estas declarando <html> 2 veces y no puedes hacer eso, el head 2 veces y asi suscesivamente
__________________
[email protected]
HITCEL
  #10 (permalink)  
Antiguo 28/07/2015, 02:18
 
Fecha de Ingreso: julio-2015
Mensajes: 54
Antigüedad: 8 años, 9 meses
Puntos: 1
Respuesta: Metatag modificado hace...

Cita:
Iniciado por xfxstudios Ver Mensaje
segun el codigo este esta de mas:

Código PHP:
Ver original
  1. </div> <!-- end topbar -->
  2. <?php } ?>//elimina este de aqui

tienes dos paginas alli o que?, estas declarando <html> 2 veces y no puedes hacer eso, el head 2 veces y asi suscesivamente
Claro al ser una plantilla pues no se como lo harán ellos. Si quito lo que comentas, no carga la página.

No te preocupes intentaré hacerlo de otra manera.

Te agradezo mucho la ayuda de todas formas

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:50.