![]() |
|
Getting printSlideShowLink() to validate XHTML 1.0 Strict - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Getting printSlideShowLink() to validate XHTML 1.0 Strict (/thread-6174.html) |
Getting printSlideShowLink() to validate XHTML 1.0 Strict - bryanbrazil - 2009-11-22 If you want to get the slideshow function to validate using the XHTML 1.0 Strict doctype, here's how to do it: [list=1] [*]Copy the printSlideShowLink() function from the slideshow plugin's slideshow.php file and paste it into your theme's customfunctions.php file. [*]Give your function a new name to distinguish it from the original. I just added '2' to the end of the function name. [*]XHTML doesn't support the 'name' attribute for forms. Change "name=slideshow..." to "id=slideshow..." [*]XHTML requires form elements to be grouped using div or fieldset tags. Add div tags immediately within the form tags. [*]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()` [*]Modify your album.php and image.php files to reference the new function. [/list] 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 = '<input type="hidden" name="preserve_search_params" value="'.$_zp_current_search->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 = '<input type="hidden" name="preserve_search_params" value="'.$_zp_current_search->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) { ?> <form id="slideshow_<?php echo $slideshow_instance; ?>" method="post" action="<?php echo $slideshowlink; ?>"> <?php echo $slideshowhidden; ?> <input type="hidden" name="pagenr" value="<?php echo $pagenr;?>" /> <input type="hidden" name="albumid" value="<?php echo $albumnr;?>" /> <input type="hidden" name="numberofimages" value="<?php echo $numberofimages;?>" /> <input type="hidden" name="imagenumber" value="<?php echo $imagenumber;?>" /> <input type="hidden" name="imagefile" value="<?php echo html_encode($imagefile);?>" /> <a id="slideshowlink_<?php echo $slideshow_instance; ?>" href="javascript:document.getElementById('slideshow_<?php echo $slideshow_instance; ?>').submit()"><?php echo $linktext; ?></a> </form> <?php } $slideshow_instance ++; } ` Getting printSlideShowLink() to validate XHTML 1.0 Strict - Laurent - 2009-11-26 Thank You Laurent |