Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Separate link on top
https://www.tinywebgallery.com/forum/viewtopic.php?f=4&t=572
Page 2 of 2

Author:  TinyWebGallery [ 19. Oct 2006, 14:50 ]
Post subject: 

not globals - make parameters,

I use a lot of globals but only for all parameters from the config and for language strings. (and some places where I hadn't have time to refactor them yet :).)

other globals really make code much harder to read because you never know where a parameter is modified and where it comes from :).

/Michael

Author:  Mini [ 19. Oct 2006, 15:15 ]
Post subject: 

Don't understand, I wrote:

function getPDF($filetype) // here I am searching for pdf's and show a link if there are
{
global $basedir;
global $twg_album;
$dir_handle = opendir($basedir."/".$twg_album);
while(false !== ($entryname = readdir($dir_handle)))
{
$splitentryname = explode(".", $entryname);
$sizesplitentryname = count($splitentryname);
$fileext = $splitentryname[$sizesplitentryname-1];
$fileext = strtolower($fileext);

if($filetype == $fileext)
{
echo "<a href='$basedir/$twg_album/$entryname'><font size='2'>Download $entryname</font></a><br>";
}
}
}
getPDF("pdf");

and it works, I know basedir is "pictures" but I really need twg_album to tell the album... or not?

Author:  TinyWebGallery [ 19. Oct 2006, 15:38 ]
Post subject: 

it's only nicer the other way - any yes 'picures' can be fix in your case.

/Michael

Page 2 of 2 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/