Member
Member
marcov   2010-11-26, 06:06
#1

Let's say I install ZP in a /gallery folder, below my site root.
The site root has an index.php file which is a simple home page with a menu like this: Home Blog Gallery About.

The /gallery will contain all the ZP files: index.php, albums.php, etc. The "Gallery" menu entry would call the ZP index.php file so that I can have the full ZP functionality.

On my home page I just want to pull thumbs from any single ZP albums folder into my index.php home page. I would do this using the printRandomImages or any other function that would allow me to do that. (Then I would want to display the single images from the thumbs).

*** The question is, what do I have to include at the top of my site root index.php file to be able to then use the ZP functions and achieve the above?

I searched the user guide and the forum but so far I did not find anything on this.

Member
Member
micheall   2010-11-26, 08:12
#2

You could try taking a look here. This is the "How to use Zenphoto as a plugin" tutorial. I don't believe it will function right if your main site is built in wordpress though (not sure if that's been fixed).

Administrator
Administrator
acrylian   2010-11-26, 11:01
#3

It is not fixed as it is not our fault. It is because of changes in Wordpress. Wordpress does not call template pages "directly" anymore since 3.x (I think). It calls them through a function which means all global variable contexts Zenphoto needs to work are cleared by doing that. This might be the case with other systems as well.

This is nothing we can do to fix since Zenphoto is considered to be a standalone system. Sorry.

The only way would be to declare all globals Zenphoto might need within Wordpress (which might require hacking it). Or building workarounds like we do on our homepage (it is btw planned to move the site to Zenphoto only once we find the time).

Member
Member
marcov   2010-11-26, 16:27
#4

Oh, for now I'd only like to call ZP from a simple index.php file in my site's root folder, not from Wordpress. Is there any way to do that? I mean, If my site index.php has the right includes, couldn't it call and run the ZP functions I need?

Member
Member
sbillard   2010-11-26, 17:56
#5

Have you looked at the link micheall provided?

Member
Member
marcov   2010-11-26, 18:19
#6

I did now, thank you micheall for the link, I think that is exactly what I need. I will try it out.

Administrator
Administrator
acrylian   2010-11-26, 19:55
#7

Of course if you use a plain index.php file without any other CMS that should still work. Probably just over explained a little..;-)

Member
Member
marcov   2010-11-29, 16:31
#8

I tried to display the thumbs for a single album on the index.php page om my ZP insallation; I used
`

to load the album specific single context, followed by the

...
`
loop to display the album thumbs. it did not work.
I get a blank page, no thumbs.

My index.php works fine if I use the typical loops:
`

...

or

...
`
Again, what I am trying to do is to display on the index.php home page the images from a single folder that I want to be able to specify. In this test the index.php is in the ZP themes folder.

Member
Member
marcov   2010-11-29, 16:38
#9

PS. The were added by the forum when I edited the post. I could not further edit it, the forum is extremely slow, it takes minutes to load.

Administrator
Administrator
acrylian   2010-11-29, 18:27
#10

Yes our site is under heavy traffic every now and then and lot of spammer register to the forum to missuse our profile pages as link depository (via Twitter for example). Too bad that they did not read the notes on registering that no one will be able to see that. (I don't know what you mean the forum has added).

Anyway, to the topic. What you does and can simply not work. /zenphoto/Latest would be an subalbum "Latest" within an album "zenphoto" within the albums folder. You have to setup the object global of the current album (the global $_zp_current_album) use the object model framework to get this working. Please read http://www.zenphoto.org/2010/02/zenphotos-object-model-framework/

Member
Member
marcov   2010-11-29, 19:21
#11

Thank you for the hint. I read the object framework and I tried this:
`

... standard image loop code that works ...

`

"latest"is the name of the individual folder within the ZP "albums" folder. Again, it did not work.

By the "forum added" I meant the `` shortcodes in the code.

On spammers: your site does a very good job though in getting rid of the spam. If waiting a few minutes is what it takes, no problem.

Administrator
Administrator
acrylian   2010-11-29, 19:48
#12

You have to setup the global for the current album using makeAlbumCurrent($albumobject). Then $_zp_current_albumcontains the album object you just setup.

Member
Member
sbillard   2010-11-29, 19:48
#13

Many functions, such as next_image() work only if all the correct context is setup. Fortunately, what you want to do has been anticipated. Usethe function makeAlbumCurrent($albumobject) to setup the context before the next_image() loop.

Member
Member
marcov   2010-11-29, 20:23
#14

Bingo!!! Here's the code for anybody else who wants to display thumbs from a specific album:

`

... loop code

`
Inside the loop I used the getCustomImageURL() so that I can display the larger image in a lightbox. To display it using image.php replace it with getImageLinkURL()

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.