Random block isn't XHTML valid

jonMEGA

Joined: 2002-10-22
Posts: 71
Posted: Tue, 2005-01-25 16:43

The random block script isn't XHTML valid. I made a few changes:

echo ""
                        . '<center><a href="' . makeAlbumUrl($album->fields['name'], $id) . '"/>'
                        . $album->getThumbnailTag($index)
                        . '</a></center>';

                $caption = $album->getCaption($index);
                if ($caption) {
                        echo '<br /><center>' . $caption . '</center>';
                }

                echo '<br /><center>From: '
                        . '<a href="' .makeAlbumUrl($album->fields['name']) .'" />'
                        . $album->fields['title']
                        . '</a></center>';

The img tag needs a /> for it to validate how can I change this?

 
lawtai

Joined: 2004-07-06
Posts: 40
Posted: Wed, 2005-02-16 16:37

have you figured out how to validate the img tags?

 
UGN Security

Joined: 2006-03-22
Posts: 2
Posted: Wed, 2006-03-22 03:54

It's rather easy, and frankly I'm suprised it isn't done in the stock code... I hunted it down in about 3 minutes, go fig for striving for main page validation ;)...

Anyhow, open gallery/classes/Image.php

Find:

	    if ($this->resizedName && $size == 0) {
		if ($full) {
		    return "<img src=\"$dir/$fullImage\" ".
			"width=\"$this->raw_width\" height=\"$this->raw_height\" .
			$attrs alt=\"$alttext\" title=\"$alttext\">";
		} else {
		    return "<img src=\"$dir/$resizedImage\" ".
			"width=\"$this->width\" height=\"$this->height\" " .
			"$attrs alt=\"$alttext\" title=\"$alttext\">";
		}
	    } else {
		return "<img src=\"$dir/$fullImage\" $size_val $attrs alt=\"$alttext\" title=\"$alttext\" name=\"photo_j\">";
	    }
	}

Replace:

	    if ($this->resizedName && $size == 0) {
		if ($full) {
		    return "<img src=\"$dir/$fullImage\" ".
			"width=\"$this->raw_width\" height=\"$this->raw_height\" .
			$attrs alt=\"$alttext\" title=\"$alttext\" />";
		} else {
		    return "<img src=\"$dir/$resizedImage\" ".
			"width=\"$this->width\" height=\"$this->height\" " .
			"$attrs alt=\"$alttext\" title=\"$alttext\" />";
		}
	    } else {
		return "<img src=\"$dir/$fullImage\" $size_val $attrs alt=\"$alttext\" title=\"$alttext\" name=\"photo_j\" />";
	    }
	}

I'd like to request that this be added in the stock code of G1 so that the random block be *valid* xhtml!