ZenphotoCMS Forum
Random Photo not working on 'sub-directory'. - 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: Random Photo not working on 'sub-directory'. (/thread-2581.html)

Pages: 1 2


Random Photo not working on 'sub-directory'. - invision - 2008-04-02

Hi!

I have a site, e.g. www.michaelsite.com/michaelspages/wordpress which displays a random thumbnail and does so rather well

However, I also want to display it in my zenphoto directory, so if I type in:
www.michaelsite.com/michaelspages/zenphoto/gallery1 the random photo will appear, however, this does not work. When I right-click the image to see the src, it has an extra 'zenphoto' in the address

How do I get around this issue?
Is it to do with my 'template-functions.php' file?
Or is there a bit of PHP I can do to eliminate any 'extra' zenphotos from the image src address.

Basically my use of the printRandomImages function is in a small php file held in www.michaelsite.com/michaelspages which then does the function and displays the pic - is this causing the issue?

Many thanks for any help.

Am happy to supply a link, if it could be removed at a later stage.




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

Did you set the right home (main) page path in the zenphoto options? That needs to be a full path like http://www.michaelsite.com.
Did you use the "zenphoto as a plugin" solution from our extenstions page?

I guess it would be easier if you post a link, we of course can remove it later if you wish.




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Thanks for the reply

OK.

As you can see bottom left:
it works great

However as you can see bottom left:
it doesn't work

The file I'm using(that stores the printRandomImages() function) is at:

The code for 'test.php' is:

`

`

Any help at all, you can give, would be brilliant.

Thank you.




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

It's has clearly to do with the WEBPATH, but I just don't see right now...

Did you try exactly the solution "zenphoto as a plugin" on our extensions page: http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin

I have to admit I never tried that personally...(I just built two themes....;-))




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Yes, it's definitely the webpath. It seems to add that extra 'zenphoto' to the path, where it's not needed

I'm now using:

`

`

But still the same error

Any ideas?




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

Yes, please try that. Can't do much more than not working, right?..:-) This is a common way to combine for example wordpress and zenphoto and has been done several times. We use it that way on zenphoto.org, too (to be exact that part aitf311 did set up).




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Please see ammended post above.

I used that but still got the same error.




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

Ah, try this, set for WEBPATH your full basic path `http://www.domain.com".

Well, I fear I am not gaining any glory from this today...I guess we better wait until one of my fellow devs who actually used it himself appears...




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

I got an error

Fatal error: Call to undefined function: printrandomimages() in on line 10

With the code

`

`

Hmm, I'm tearing my hair out here.




Random Photo not working on 'sub-directory'. - aitf311 - 2008-04-03

What version of Zenphoto are you using? the Stopdesign theme prints random images, check out its index.php and look at lines 88 - 96




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

How do I check what version it is?

I see the Stopdesign code(it also doesn't work when I take it down to to the zenphoto directory). I just don't know why it can display a random image on one part, but not the other

Is it because my 'test.php' is in the WordPress folder?

Would it make more sense to have ZenPhoto in the 'wordpress' directory, so it'd be wordpress/zenphoto/




Random Photo not working on 'sub-directory'. - AlexWilson - 2008-04-03

try
define('WEBPATH', '/flannigan/zenphoto');




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Re: AlexWilson

Tried that, but got a very ugly error:

Warning: main(/flannigan/zenphoto/zp-core/template-functions.php) [function.main]: failed to open stream: Operation not permitted in /home/mysiteuk/public_html/flannigan/wordpress/test.php on line 4




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

Yes, try placing zenphoto within the wordpress folder.




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Sorry to be such a newbie on this, but should it just be a case of moving the directory, to be under wordpress, or should I have to make any tweaks in the admin part?

You have all been very patient, and hopefully this resolves the issue.




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Man, no matter what I do, it won't work

I've now got it so 'zenphoto' is below my 'wordpress', but it's still adding the 'zenphoto/eric-flannigan' part TWICE to my URL, when in zenphoto

E.g visit: - look at the random pic, bottom left and look at the img src for it.

I'm losing the will to live. Someone please help me out

`

`




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

The include line, referencing the 'test.php' file is actually in the 'header.php' file in my WP theme folder.

I use the same 'header.php' for my WP as I do for ZP.

Would this cause a problem?




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

GOT IT WORKING!!!

Runs off to play Boston - More than a Feeling so loud, it'll become popular again

Moderator:
Please remove the links to my temp site. Thanks!

Thank you once again for all your input.

In the end, I made two 'test.php' files and tweaked one of them.




Random Photo not working on 'sub-directory'. - acrylian - 2008-04-03

Great! I have removed the links.




Random Photo not working on 'sub-directory'. - invision - 2008-04-03

Many thanks.