Basic concepts (init(), handleRequest(), etc.)

hokietoner

Joined: 2006-07-12
Posts: 4
Posted: Wed, 2006-07-12 02:46

I'm new to gallery integration programming. I've been reading about how to use the API to create my own integration code, but I'm confused by a couple things.

When I create a user on my site, I of course need to call GalleryEmbed::createUser(). But to call the GalleryEmbed functions, I need to first call init(). But init takes a current user as a parameter. Does that mean I have to essentially log in before I can create a user? So would I specify my admin account as the account to pass in the init function? But if so, would that log in my admin account for the user trying to create their own account, and if so, do I need to then call logout()?

I don't understand handleRequest completely. I know that you can use it to get the html data for showing the actual entire gallery. But for just calling methods in GalleryEmbed(), do I need to use it? But if I don't, then I need to pass fullinit as true in init(). Is this what I should be doing for pages that just make API calls?

Thanks
-Ryan

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-07-12 08:33

did you read:
http://codex.gallery2.org/index.php/Gallery2:Embedding

specifically:
http://codex.gallery2.org/index.php/Gallery2:Embedding:Integration#On-the-fly_User_Creation

if there's no user yet, just call GalleryEmbed::init(...) without an activeUserId. you can then call GalleryEmbed::createUser() or map the existing users.

@handlereqzest:
no, don't call GalleryEmbed::handleRequest() if you don't want to render a page.

@fullinit:
please read the documentation. only needed if you do not call handleRequest.

 
hokietoner

Joined: 2006-07-12
Posts: 4
Posted: Wed, 2006-07-12 12:29

You must not have finished reading my post. I understand that I only need fullinit=true if I do not call handleRequest. Along with comments in the gallery code, the documentation that I read was this:
http://codex.gallery2.org/index.php/Gallery2:Integration_Howto

That is the only link to embedding/integration documentation listed in the FAQ, so I thought that was all there was. I will take a look at the page in your post; it looks much more useful than the Howto.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-07-13 07:30

i read your post to the end. just emphasizing that the above linked docs cover this material. thanks.