Any way to change Drupal's default HTML tags?
Deathlock - April 6, 2008 - 11:35
Is there any way to change Drupal's default HTML tag?
For instance, I want to change:
to
(the HTML above can be seen in log in submission)
Because it conflicts with w3c HTML validation, thus making my site invalid. Thanks. :)

Ah, I forgot the code tag. I
Ah, I forgot the code tag.
I mean:
<input type="submit" name="op" id="edit-submit" value="Log in" class="form-submit" />to
<input type="submit" name="op" value="Log in" class="form-submit" />Thanks.
try to use redefining drupal
try to use redefining drupal theme functions.
for example there is a theme_button() function, which is producing HTML code for a button.
You can override this function using phptemplate engine by creating template.php file in your theme's folder and simply including
new youthemename_button() function into it.
More information on drupal theme functions you can find at api.drupal.org.
And also the online documentation on phptemplate, of course :)
Thanks.. but doesn't work?
Thanks..
I've tried to add the function into phptemplate but it seems won't work.
I'm trying to change:
<?php
function bleachin_button($element) {
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
return '<input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'id="'. $element['#id'] .'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
}
?>
into
<?php
function bleachin_button($element) {
// Make sure not to overwrite classes.
if (isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'form-'. $element['#button_type'] .' '. $element['#attributes']['class'];
}
else {
$element['#attributes']['class'] = 'form-'. $element['#button_type'];
}
return '<input type="submit" '. (empty($element['#name']) ? '' : 'name="'. $element['#name'] .'" ') .'" value="'. check_plain($element['#value']) .'" '. drupal_attributes($element['#attributes']) ." />\n";
}
?>
(notice that the ID has gone on the 2nd quotation)
But even though I have put away the ID attribute on phptemplate, actually on the site it's just still there. It seems I can't remove the ID.
I'm using Drupal 5 anyway.
looks like you're doing the
looks like you're doing the right thing.
Perhaps the id was coming from the attributes, although I wouldn't have thought so from looking at the code.
could
<?phpunset($attributes['id']);
?>
or something do the trick?
Did you try putting other test output into that function to see that it's really the one being used?
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
Or you can just add
Or you can just add this.
<?php/**
* Fixes illegal duplicate html id's "edit-sumit". Remove in 6.
*/
function phptemplate_submit($element) {
static $dupe_ids = array();
if (isset($dupe_ids[$element['#id']])) {
$dupe_ids[$element['#id']]++;
$element['#id'] = $element['#id'] .'-'. $dupe_ids[$element['#id']];
}
else {
$dupe_ids[$element['#id']] = 0;
}
return theme('button', $element);
}
?>
Increments for every duplicate it finds.
⎋ joon park
–www.dvessel.com–
Thanks! Guess that works. :D
Thanks!
Guess that works. :D