Cambio de logo según url path

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by alfonsojosegarcia on October 23, 2013 at 9:32pm

Hola,
estoy intentando cambiar mi logo en una parte de la web. Estoy utilizando el siguiente código en mi propio theme dentro de template.php:

function mitema_preprocess(&$variables, $hook) {
if ((arg(0) == 'noticias')) {// changes the logo and site name when viewing blogs
$variables['site_name'] = 'firstpath_site_name'; // change the site name
$variables['site_slogan'] = 'firstpath_site_slogan'; // change the site slogan
$variables['logo'] = 'logo2.png'; // change the site logo
}
}

Con el código anterior puedo cambiar el logo en la url www.miwebejemplo.com/noticias, pero como podría cambiar el logo para todas las urls que esten dentro de esa, ejemplo:

www.miwebejemplo.com/noticias/ejemplo
www.miwebejemplo.com/noticias/ejemplo2
www.miwebejemplo.com/noticias/ejemplo/ejemplo3

De este modo no funciona:

function mitema_preprocess(&$variables, $hook) {
if ((arg(0) == 'noticias/*')) {// changes the logo and site name when viewing blogs
$variables['site_name'] = 'firstpath_site_name'; // change the site name
$variables['site_slogan'] = 'firstpath_site_slogan'; // change the site slogan
$variables['logo'] = 'logo2.png'; // change the site logo
}
}

Gracias por adelantado.

Categories:

Comments

Hola! No sé si esa es la

Posted by jansete on October 24, 2013 at 12:22am

Hola!

No sé si esa es la mejor forma de modificar el logo, pero bueno creo que puedo ayudarte, supongo que www.miwebejemplo.com/noticias es una vista con todas las noticias y que www.miwebejemplo.com/noticias/ejemplo es un contenido noticia, si el nombre del sistema fuese "noticias" quizás sea "article" o "story" adáptalo en tu caso, la función quedaría así.

function mitema_preprocess(&$variables, $hook) {
$node = node_load(arg(1)); //Obtenemos el objeto nodo de la página actual
//el $node->type correspondería con el nombre máquina de tu contenido
if ((arg(0) == 'noticias') || (($node) && ($node->type == 'noticias'))) {
$variables['site_name'] = 'firstpath_site_name'; // change the site name
$variables['site_slogan'] = 'firstpath_site_slogan'; // change the site slogan
$variables['logo'] = 'logo2.png'; // change the site logo
}
}

Cuéntame el resultado, suerte, saludos.

Spain

Group organizers

Group categories

Región geográfica

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /