Validating block-random.php

clarke1866
clarke1866's picture

Joined: 2004-06-05
Posts: 4
Posted: Tue, 2004-06-08 21:55

Greetings all,
Recently I have been workin away on the block-random.php script from http://www.barcahall.com/gallery-block-random.html. I have been trying to simply incorperate the script into a normal php webpage. A major breakthrough was accomplished thanks to floridave (see http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=17356)

Since then, I have been trying to make my webpage XHTML 1.0 compliant along with stripping out all the style information from the script. I have been able to remove the CSS and gallery references to create a page with just plain text and an image, but I have been unable to get w3c validation. I was hoping someone could help me out. See [url]www.maxpower.ca/123.php[/url] for the page I create to help with this procress. It simple calls the the block-random.php script. Pasted below is what I think is the relevant portion of the code that does not validate:

if (isset($index)) {
   $id = $album->getPhotoId($index);

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

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

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

It appears to me the problem lies in just one line of code: "<a href=" .makeAlbumUrl($album->fields["name"], $id) ." $targetAttr>"

This portion of the php produces this html output (for example):

Quote:
<a href=http://gallery.maxpower.ca/edtown2vancity/IMG_0317 target=_blank><img src="http://gallery.maxpower.ca/albums/edtown2vancity/IMG_0317.thumb.jpg" width="113" height="150" border="0" alt="" title="" name="photo_j" /></a><br/>IMG_0317.jpg<br/>From: <a href=http://gallery.maxpower.ca/edtown2vancity target=_blank>Road Trip: Phil Heads West</a><p>

The validator complains that

Quote:
an attribute value specification must be an attribute value literal unless SHORTTAG YES is specified

I have no idea what this means, however I have figured out that the problem is the lack of quotes in the HREF section. (see the red highlighting). These red areas should be within quotes (for example, see how the blue highlighting is in quotations). So, how do I alter the code to make the HREF's go into quotes?

Feel free to see examples at [url]www.maxpower.ca/123.php[/url] and http://www.maxpower.ca/block-random.txt of the php code.

Thanks for any help,

Kirk
[url]www.maxpower.ca[/url]

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Wed, 2004-06-09 01:44
Quote:
So, how do I alter the code to make the HREF's go into quotes?

Kirk (and anyone else),
Feel free to email me directly with questions about the version of block-random.php that I maintain on <http://www.barcahall.com/gallery-block-random.html>; my email address is on that page. My version is a derivative from the original block-random script; I would be happy to incorporate your suggested modification.

-Jeff

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Wed, 2004-06-09 02:04

Kirk,

I have just made the changes to quote-delimit the attribute values in the <A> tags output within the random image block. You may retrieve the latest version from http://www.barcahall.com/gallery-block-random.html .

-Jeff

 
clarke1866
clarke1866's picture

Joined: 2004-06-05
Posts: 4
Posted: Mon, 2004-06-14 09:05

Awesome thanks for the changes! There were other things that had to be changed as well in order to pass validation, mostly the removal of all style elements and capitalisation if I remember correctly. Thanks for your help!