folderblog
What is folderblog?
Folderblog is a free PHP script that automatically displays the images placed in a given directory, no database needed. It can be used as a blog or gallery — and anything in between.

» demo blog   » learn more   » download now

Discussion
"?" lost in the links(back to index)
Hi Guys:
My server is WIN-S 2003 + IIS 6 + PHP4. I just replace $_SERVER["REQUEST_URI"] with $_SERVER['PHP_SELF'] on fb.php and set $use_alt_url to 1 in fb_settings.php.
When the main page is loaded (fb.php), the links of the thumbs include the ?p=image/MyImage/ (that's ok) , but when click any thumb, in the new page the "?" are missing in the links.
Any idea is welcome! Thanks!
posted by Carlos on 25 Nov 05 at 3:27 PM
I'm having the same problem if anyone knows of an answer to this.
posted by anon on 28 Nov 05 at 9:26 PM
OK, let me preface this by saying that this is a total hack. I'm not familiar with PHP, but I replaced a "" in what I think is a ternary operator on about line 20 from
$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . (isset($_GET["p"]) ? "" : "?p=");

to:

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . (isset($_GET["p"]) ? "?p=" : "?p=");

in fb.php and this worked

Hopefully this will work for you, it did for me.
posted by suffrin on 28 Nov 05 at 10:07 PM
Then you could also directly write

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . "?p=";

:) Maybe the problem is that your servers dont correctly offer the $_GET variable. A real solution could be to replace the $_GET by $_REQUEST, but this is just a guess.
posted by ikue on 29 Nov 05 at 2:48 AM
Is there any way to tell if this is the case? Can you suggest some test code? I've started looking into PHP, but I know embarassingly little at this point.
posted by anon on 29 Nov 05 at 2:44 PM
Simply try replacing all $_GETs bei $_REQUESTs.
posted by ikue on 29 Nov 05 at 2:56 PM
(and tell me whether it worked)
posted by ikue on 30 Nov 05 at 2:25 AM
I just tried it and the "?" was missing again
posted by anon on 30 Nov 05 at 10:12 AM
I don't know if this is related to this modification or not, but the comments post in the /photos directory.
posted by suffrin on 30 Nov 05 at 10:14 AM
I also noticed that if I switch the positioning of "" and "?p=" that the blog works.
posted by suffrin on 30 Nov 05 at 10:28 AM
which comments? if you talk about title + captions, this is normal in fb3.

Just to give you some more insight, obviously fb works on your server only if "?p=" is attached in that line.

This in turn only happens with the original code when isset($_GET["p"]) = true, meaning the variable $_GET[p] is set as a parameter. I cannot tell you right now why this problem occurs with you as I work on an Apache server only. But if you want to do some debugging yourself, try to find out all the data stored in $_GET by inserting a line somewhere there like

print_r($_GET);

This prints out all contents of that array variable. If you want to, post the results here.
posted by ikue on 30 Nov 05 at 10:54 AM
First off, I would like to thank you for what you have done and the amount of time you have spent on this helping everyone. :)

I placed this line of code just under the modified statement like so.

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . "?p=";
print_r($_GET);

I got the following return when I clicked an image.

Array ( [p] => image/locust/ )

where the current image was locust.jpg

Just to be certain I checked with the original line of code and got the same return for print_r($_GET); on the first page.
posted by suffrin on 30 Nov 05 at 12:51 PM
Interesting... so at least the $_GET variable works fine. Just a general questions, do you have any further errors when you simply use the workaround

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . "?p=";

we discussed above? I wonder why this issue never came up before - we have to find out whether it occurs just with your server configuration or in general. Thats why I love programming, you never know what you can expect. ;)
posted by ikue on 1 Dec 05 at 3:23 AM
Replacing:

path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . (isset($_GET["p"]) ? "" : "?p=");

With:

$path[0] = $fbfile = str_replace($path[1], "", $_SERVER['PHP_SELF']) . (isset($_GET["p"]) ? "?p=" : "?p=");

The "?" appears well and work!!! Thank you suffrin and thanks to donald too. Folderblog is simple, but is all I need.
Carlos.
posted by Carlos on 1 Dec 05 at 7:44 PM
I am mistaken about what I said before about the comments showing up in the photos folder. I think they do not show up at all. Can you give me some idea where the problems might occur? I'm wondering if it could be related to this change, though I did create the link artificially with the other settings and the comments still did not show up. Do your comments work, Carlos?

btw, I'd also like to figure out a way to connect this to my gallery engine at some point. I'd be happy to work with you on it later down the road if you are interested. Http:www.iamba.org/livingspace
posted by suffrin on 2 Dec 05 at 9:42 AM
I wanted to clarify two things, first the syntax of the link. http://www.iamba.org/livingspace/ , second I think the flash object could be a nice option to add to folderblog, not you offering free help to my personal project. :) Thanks for your help so far.
posted by suffrin on 2 Dec 05 at 9:49 AM
suffrin, very interesting website you created there! Although usually I am more the speed reading type of person, I took my time to see every little amazing sculpture...

I would need more details to tell you what happened to the comments. Some suggestions:
- does the comments folder have to necessary writing rights?
- did you include the comments tag in your main template where you want to show them?
- any error messages when adding new comments? where can that be done?
posted by ikue on 4 Dec 05 at 5:17 PM
I will have to confirm write permissions with my Hosting Company, but I believe they should be set. Captions aren't showing up either and I don't see anything written in there. My gut instinct tells me the directory path isn't being set correctly for my server when updating these files like it was in the beginning. Any ideas which lines / functions I can check to see what path is being used when these files are created?
posted by suffrin on 6 Dec 05 at 1:14 AM
P.S. Thanks for the comments on the sculpture. :)
posted by suffrin on 6 Dec 05 at 1:14 AM
If you say captions dont show up either, can you then enter them at all? I mean by the integrated administration interface? Any error message here after you submit changes in title or description?
posted by ikue on 7 Dec 05 at 2:06 AM
There are no errors and no captions or titles. The page simply reloads and the information is lost. Is there any kind of "trace" I can put in the code to display the path the changes would be saved to?
posted by suffrin on 8 Dec 05 at 10:55 AM
Somewhere in the bottom part of the code you find a line like "fwrite(...)", there you can easily print out the file path and the information that the script stores.
posted by ikue on 9 Dec 05 at 2:19 AM
Ok, getting somewhere. The information is stored now, but it's stored in a file called "_com.txt". There is no prefix to the file name and as a result it is not associated with a file. If I change the file name to have a prefix of one of the image names (ie. myImage_com.txt) then when I load the myImage page, the comments all show up under that image. Apparantly the image name is not being added to _com.txt. Any idea what file this would occur under? I'm using the almanac stylesheet. Would this occur under almanac_main or under fb.php? I have no idea where this would occur.

Thanks
posted by suffrin on 11 Dec 05 at 1:13 AM
Almanac has nothing to do with it as the templates are only responsible for "printing out" the information that fb delivers.

The symptoms then are clear, somehow there is a problem in the filename stored in the variable that is used in fwrite(). The reasons in turn not directly...

First of all, which folderblog version are you using precisely? folderblog 2? 3? ikue reloaded?

Furthermore, it seems to me you mixed up something about titles/descriptions and comments. These things are *not* the same. Comments are texts which any visitor can add, and are stored in a file with the extension "_com.txt". Titles/captions is that information you can only enter via the administration interface, and is stored in the photos directory in the form "imagename.txt". At least from fb 3 onwards.
posted by ikue on 11 Dec 05 at 5:55 AM
I'm recreating this thread here:
http://folderblog.org/discussion/1615/

to make the topic more searchable if that's ok. Sorry for not doing this sooner.
posted by suffrin on 11 Dec 05 at 11:31 AM
Post a Reply:

Name:    Remember me
URL:    
(include http:// or mailto:)
(back to index)