PDA

View Full Version : PHP Photo Album script v2.11 - info/help



designer_new
05-07-2010, 11:41 PM
1) Script Title: PHP Photo Album script v2.11

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem:

This is a great script! As far as getting the look I want, I have a few questions:

- I am only going to have a set amount of pictures. Is there a way to remove the [page 1] link/ text when there is only 1 page?

- I was putting the script in a table. I tried centering it within the table, but it never does. Is there a way to center this script? (Tried <center>, tried <div>center, tried adjusting the table properties...)

- Is there a way to separate the page link from the album container. My thought is to put it somewhere else on the page and make the text links a graphic.

Any ideas? In advanced, thanks for the input.

jscheuer1
05-08-2010, 04:24 AM
- I am only going to have a set amount of pictures. Is there a way to remove the [page 1] link/ text when there is only 1 page?

Add to the ddphpalbum.css file:


.albumnavlinks{ /*CSS for DIV containing the navigational links*/
display: none;
}



- I was putting the script in a table. I tried centering it within the table, but it never does. Is there a way to center this script? (Tried <center>, tried <div>center, tried adjusting the table properties...)

Generally center (be it the tag, or an attribute of another tag) is not the way to go. One can set the width of a containing division to the desired width and give that division:


margin: 0 auto;

style. In IE this requires a valid URL DOCTYPE.


- Is there a way to separate the page link from the album container. My thought is to put it somewhere else on the page and make the text links a graphic.

They are separate. You may position them via css. Their id is "phpphotoalbumvar_paginate". Where phpphotoalbumvar is the unique identifier you configured in the init.

As for making them image instead of text links, here is where in the ddphpalbum.js code they are created:


buildnav:function(){
var thisalbum=this
var navid=this.albumdivid + '_paginate'
document.write('<div id="' + navid +'" class="albumnavlinks">')
for (var i=1; i<Math.ceil(this.albumvar.images.length/this.photodivs.length)+1; i++){
document.write('<a href="#Page' + i+ '" rel="'+i+'">Page'+i+'</a> ')
}
document.write('</div>')
var navdiv=document.getElementById(navid)
phpimagealbum.routines.addEvent(navdiv, function(e){
var e=window.event || e
var target=e.srcElement || e.target
if (target.tagName=="A"){
thisalbum.gotopage(target.getAttribute('rel'))
if (e.preventDefault)
e.preventDefault()
else
return false
}
}, "click")
this.navlinks=navdiv.getElementsByTagName('a')
this.navlinks[0].className="current"
},

The highlighted section is where the text seen is made, let's zoom in:


document.write('<a href="#Page' + i+ '" rel="'+i+'">Page'+i+'</a> ')

Which produces Page1, Page2, etc. You could change that to:


document.write('<a href="#Page' + i+ '" rel="'+i+'"><img src="page'+i+'.gif" alt="" border="0"></a> ')

As long as you have page1.gif, page2.gif, etc. it will work out.

As layouts vary, if you want more help with any aspect of this:

Please post a link to a page on your site that contains the problematic code so we can check it out.