Script help please:

Well, I remember looking at this a couple months ago and found a way to fix that.
I have it installed somewhere. I will look at it and let you know. I have some time in the morning if not tonight.

One question… Do you have graphics for those folder names already? I mean, you have, let’s say bigwheel and shopping. Do you have special images already for those two or are you wanting to just put the same image for each?

It looks like SIF is set up to be flexible and if you change the folders, it changes with them.
If you hard code folder images, you will have to change the code when you change a folder.
(Such as adding a new one or deleting one…) So, you could have a default image for folders and place
it into the folder. Then, have the new SIF code, pull it’s folder image from inside the folder. That would
work nicely as when you add a folder, just add the image, too… Did that make sense?

More later tonight or tomorrow…

Thanks Ernie,
Well yes i have graphics, a small thumbnail for each folder?

I really am a complete novice with php but with other php scripts i at least have an idea how to change stuff… this script i don’t have a clue!

That script creates the thumbnails for you. Why don’t you tell us what you are trying to do and see if there is something simpler we can come up with.

Thanks Andrew,
Good job i didn’t go in to teaching cos nobody understands me!

I really like the script and i know it creates the thumbnails for all the directories.
I am just trying to change the index.php to show thumbnails as links to the directories rather than just text, as it is now.
manchesterpicturesdotcom/sif/index.php

Thanks,
Bill

Thanks, Andrew, but, he already told us what he wanted. If you re-read the entire post…

Bill, I looked into the code for you. You could assign names to the images that correspond to the folder name. So, in your example page, you have “summer” as the name of a folder. You can name that folder’s image as “summer.jpg”. (or .gif .png, etc…) And, then whenever you print a folder name, just display the image instead. Did that make sense?

So, in the SIF code, it displays folder names in a subroutine with this code:
[php]
function RenderFolder(){
$rel=$this->base_folder;
if ($rel==".") return “”;

	$rel=explode(DIRECTORY_SEPARATOR,$rel);
	
	$parms=$_GET;
	unset($parms['site']);
	unset($parms['sif']);
	
	$pth=array();
	array_unshift($rel,basename(realpath("."))); // add the root folder also to the bread-crumps
	$notfirst=0;
	foreach ($rel as $dir) {
		if ($notfirst==1) $folder.=$dir.DIRECTORY_SEPARATOR;
		$notfirst=1;
		$parms['folder']=$folder;
		$flink="?".http_build_query($parms);
		$dir=nice_chars($dir);
		$pth[]="<a href=\"$flink\">$dir</a>";
	}
	$pths=implode("&nbsp;~&nbsp;",$pth);
	
	$s="<p class=\"folder\"><b>Folder</b>: $pths";
	
	$s.="</p>";
	return $s;
}

[/php]
As you see, this line:
$s="<p class=“folder”>Folder: $pths";
displays the Folder: some-folder-name onto the screen above the thumbs…
You would have to alter this line to display the image for that folder. So, you can use the $pths variable and alter it to display the image instead. So, this “renderfolder()” function will display a folder name. You would have to look where it is called and alter the code to display the folder’s image instead. As far as I can see, the display of the page is all done in this function:
[php]
function RenderSIF(){

	$this->thumber=$this->GetThumber();
	
	$str=$this->RenderTitle();
	$str.=$this->RenderFolder();
	$str.=$this->RenderTable($this->dirs_and_files);
	
	$ptit=$this->PageTitle();
	
	echo $this->html($str,$ptit);
}

[/php]
This function pulls the title, folder name and directory/files list and displays them. It adds in a page title and then turns it into html to be displayed. You would have to alter this function to display an image instead of the folder name. Did all that make sense???

To do this, you would have to alter the “renderfolder” function, in this section of the code:
[php]
$pths=implode(" ~ ",$pth);

	$s="<p class=\"folder\"><b>Folder</b>: $pths";
	
	$s.="</p>";
	return $s;

[/php]
This section takes the $pth and places it into $pths variable which is then displayed with Folder: and text.
You would have to change this section to take the folder names out of $pth and replace it with an “img” tag. Which would point at the images you have for the folders. Loosely something like this:
s$="<img src=\folder_images" . $pth . “.jpg”>";
I am not sure at all of this is the real code you need. If you can not get it working let us know and I will test it when I have more time tomorrow…

Well, there you have all of the sections that involve your project. Look at them and if you still can’t figure it out, I will help. I am just out of time to test this right now. Hope this much helps you solve it…

Sponsor our Newsletter | Privacy Policy | Terms of Service