Benutzeranmeldung
hoelterhof.net
Tobias Hölterhof
Schlagworte Blog
Feeds
Neueste Kommentare
- cheap canadian cialis ,
vor 16 Stunden 39 Minuten - Da gefällt mir doch die
vor 18 Wochen 14 Stunden - HalliHallo,
ich habe schon
vor 22 Wochen 2 Tage - Hallo Lothy, das ist
vor 23 Wochen 3 Tage - Hallo Dirk, danke für Deinen
vor 23 Wochen 3 Tage - Hallo, also das Ticket der
vor 23 Wochen 3 Tage - Hallo ich würde gerne wissen
vor 26 Wochen 1 Tag - Es ist total einfach Ich
vor 28 Wochen 1 Tag - Das stimmt übrigens so nicht
vor 28 Wochen 2 Tage - Ich hab das Handy vor kurzem
vor 32 Wochen 4 Tage
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) 2011 Tobias Hölterhof | CMS Drupal | Layout basiert auf Abac von Artinet
Neue Inhalte
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