Blok skal kun vises på bestemt indhold

Spørgsmål: 

Hvordan styrer jeg at en blok kun skal vises på mine artikelsider i Drupal 6?

Svar: 

Der er ikke nogen simpel konfiguration til dette i Drupal 6 medmindre du vil indtaste alle URL's for dine artikler i de Sidespecifikke synlighedsindstillinger
under indstillinger for den enkelte blog, men en lille snip php kode i samme felt (husk at slå PHP-filter til) kan hjælpe til:

<?php
$match = FALSE;
$fetchurl = explode("/",$_SERVER['REQUEST_URI']);
if (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == 'artikel') {
$match = TRUE;
}
}
if ($fetchurl[1] == 'artikler') {
$match = TRUE;
}
return $match;
?>

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.