Benutzeranmeldung
hoelterhof.net
Tobias Hölterhof - Philosophie und Medien
Schlagworte
Reklame
Neueste Kommentare
- Hallo,
ich weiß gar nicht,
vor 7 Wochen 2 Tage - Die Tatsache, dass man Fotos
vor 9 Wochen 12 Stunden - Das mit dem Chip-Umbau ist
vor 11 Wochen 2 Tage - Hi!
Deinen Blog habe ich
vor 11 Wochen 3 Tage - Hallo! Die beiden Probleme
vor 18 Wochen 1 Tag - Hai Tobias,Danke erst mal
vor 18 Wochen 2 Tage - Na, den Vergleich halte ich
vor 19 Wochen 2 Tage - Hallo,
hier in Nürnberg
vor 21 Wochen 10 Stunden - Danke dir, ich fühle mich
vor 21 Wochen 4 Tage - Hi Tobias, würd mich mal
vor 22 Wochen 4 Stunden
How to theme the trackback URL in Drupal
Just a little detail: do you like the way how the trackback-module displays the trackback-url on your drupal-site? There's a simple way to change this behavior. It requires some little changes in the module-source, but perhaps that will give you an understanding of the programming of drupal-modules...
At first have a look at the trackback.module file, especially on line 261:
$node->body .= theme('box', t('Trackback URL for this post:'), url('trackback/'. $node->nid, NULL, NULL, TRUE));
this line themes the trackback-url. Unfortunately the theme-function "box" is used to do that. The box-function creates an html-code enclosed by <div class="box">. Because there are many occurrences of this class, and it's not only used to theme the trackback-url, you can't style the trackback-url by this class in your CSS-file. To solve this problem, use a new theme-function like this:
$node->body .= theme('trackbackurl', t('Trackback URL for this post:'), url('trackback/'. $node->nid, NULL, NULL, TRUE));
Now, drupal will call the theme-function "trackbackurl" to theme the url. The next step is to create this function. The best place to do this is right here in the trackback.module. Insert the following code at the end of the file:
function theme_trackbackurl ($title, $content, $region = 'main')
{
$output= '';
$output.= $title.''.$content.'';
$output.= '';
return $output;
};
Now you can style your trackback-urls in your CSS-File. Add something like this:
.trackbackurl {
font-weight: bold;
color: #9e4040;
margin-bottom: 20px;
}
.trackbackurl .url {
font-weight: normal;
font-family: mono, courier;
color: black;
padding-left: 20px;
}
(c) 2008 Tobias Hölterhof | CMS Drupal | Layout basiert auf Abac von Artinet
Kommentare
Stelle auch gerade meine Seiten auf Drupal 5.x um. Für das Trackback-Modul habe ich folgenden Code-Snippet für die box.tpl.php verwendet:
<?php if ($title == 'Trackback URL for this post:') { ?>
Trackback url for this post:
" title="trackback">
<?php print $content ?>
<?php } else { ?>
<?php print $title ?>
<?php print $content ?>
<?php } ?>
Einfach in die box.tpl.php des verwendeten Themes einsetzen. Damit sind die Urls klickbar und können nach Belieben formatiert werden. Nicht elegant, aber funktional.
Grüße,
Harry
In Drupal 5 sieht das Trackback-Module ein wenig anders aus und es funktionert auf die oben beschriebene Art&Weise nicht mehr.
Gruß
Markus
works great. thank you.
Markus