Getting printSlideShowLink() to validate XHTML 1.0 Strict

If you want to get the slideshow function to validate using the XHTML 1.0 Strict doctype, here's how to do it:
  1. Copy the printSlideShowLink() function from the slideshow plugin's slideshow.php file and paste it into your theme's customfunctions.php file.
  2. Give your function a new name to distinguish it from the original. I just added '2' to the end of the function name.
  3. XHTML doesn't support the 'name' attribute for forms. Change "name=slideshow..." to "id=slideshow..."
  4. XHTML requires form elements to be grouped using div or fieldset tags. Add div tags immediately within the form tags.
  5. In order to get the form to submit using the form id, change the anchor link href to `javascript:document.getElementById('slideshow_<?php echo $slideshow_instance; ?>').submit()`
  6. Modify your album.php and image.php files to reference the new function.
It should look like this:

`
/**
* Prints a link to call the slideshow (not shown if there are no images in the album)
* To be used on album.php and image.php
* A CSS id names 'slideshowlink' is attached to the link so it can be directly styled.
*
* @param string $linktext Text for the link
*/
function printSlideShowLink2($linktext='') {
global $_zp_current_image, $_zp_current_album, $_zp_current_search, $slideshow_instance;
if (checkForPassword(true)) return;
if(empty($_GET['page'])) {
$pagenr = 1;
} else {
$pagenr = sanitize_numeric($_GET['page']);
}
$slideshowhidden = '';
if (in_context(ZP_SEARCH)) {
$imagenumber = '';
$imagefile = '';
$albumnr = 0;
$slideshowlink = rewrite_path("/page/slideshow","index.php?p=slideshow");
$slideshowhidden = 'getSearchParams().'" />';
} else {
if(in_context(ZP_IMAGE)) {
$imagenumber = imageNumber();
$imagefile = $_zp_current_image->filename;
} else {
$imagenumber = "";
$imagefile = "";
}
if (in_context(ZP_SEARCH_LINKED)) {
$albumnr = -getAlbumID();
$slideshowhidden = 'getSearchParams().'" />';
} else {
$albumnr = getAlbumID();
}
$slideshowlink = rewrite_path(pathurlencode($_zp_current_album->getFolder())."/page/slideshow","index.php?p=slideshow&album=".urlencode($_zp_current_album->getFolder()));
}
$numberofimages = getNumImages();
if($numberofimages != 0) {
?>
" method="post" action="<?php echo $slideshowlink; ?>">
<?php
}
$slideshow_instance ++;
}
`

Comments

Sign In or Register to comment.