Hey,
I am trying to embed Gallery2 into a PHP page. According to teh Gallery2:Embedded Rewrites tutorial and another post, you have to access the URL Rewrite admin interface from the embedded application. My question is how do I do this because when I open the page it is as if it is in guest mode. There is no link to login so I'm confused on how to access the admin interface. Any help would be greatly appreciated. And if you want me to post anything else just let me know.
Thanks,
Matt
Posts: 32509
you're supposed to login to your application and handle over the active user id to g2 in GalleryEmbed::init
before you can do that you need to map your admin user to G2's admin user with GalleryEmbed::addExternalMapEntry
Posts: 4
Thanks for the quick response valiant. I believe I'm getting someplace now. I read over some other posts and I think I got it to the point where it appears that I'm logged in as admin.
I'm not quite understanding what I did though. Below is the file that I download from the integration forum. I added an entry of (6, GalleryUser, 6) into the externalidmap in the database. Is that right?
Now my problem is that the links are broken...so if I click on an image or the SiteAdmin link at the top of the page it doesn't work. Does the php file look correct?
Document Root: /var/www/
My gallery: /var/www/localhost/htdocs/gallery2/
The php file (below): /var/www/localhost/htdocs/main.php
For example here is the link to one of the images: http://example.com/localhost/htdocs/d/14-2/DSCN0013.JPG?g2_GALLERYSID=0c43bd9e09c2d8a139ba9a328891ea67
I'm not quite sure how the links should show up, but soemthing is wrong with the links. Got any ideas?
Once again I appreciate all the help.
Thanks,
Matt
Posts: 32509
your php application, does it have user management? can you login to your website (apart from G2)?
Posts: 4
Oh...no, at least not at this time. Is that where the idea for this script comes from? Currently I'm looking to display different albums on my website. I don't really want to modify the theme because I was hoping to in the future, have two websites linking to different albums in gallery. I was thinking that I could just use the guest account (uid='') once I got it up and working. But maybe in the future, user managmement would be added.
Right now I'm having problem with broken links. I was thinking that maybe it was because of the URL Rewrite and how it says you need to access the setup for URL Rewrite through the embedded application. I'm unable to access the SiteAdmin link in my php file because of the broken links.
Posts: 32509
you don't need GalleryEmbed for your homepage then. GalleryEmbed is mainly used to embed G2 in another application and to provide user mapping/synchronization.
what you can do:
use GalleryEmbed (because you like the non-user sync features) and do not specify activeUserId as argument, just leave it out. In that case, GalleryEmbed will use the current cookie / session.
then you need to call GalleryCapabilities::set('login', true); right after GalleryEmbed::init(); and before ::handleRequest(); and you'll get the login link again.
@URLs:
set embedUri = name of your wrapper file, embedPath = path from document root to the wrapper file (certainly without localhost/htdocs, i guess it's just '/' in your case). relativeG2Path = ./gallery2/ in your case.
Posts: 4
Ok...that did it...THANK YOU SOOO MUCH VALIENT...I really appreciate your helpfullness.
I have a couple more questions though...
1. I was just wondering about the URL still... if this is my setup:
Document root of website: /var/www/
Location of wrapper file: /var/www/localhost/htdocs/main1.php
Location of gallery: /var/www/location/htdocs/galler2/
Are these right?
embedUri = main1.php
embedPath = /localhost/htdocs
relativeG2Path = gallery2
2. Is there any way that I can just display a specific album with that script?
Once again...thanks a lot and I really appreciate your help!
Matt
Posts: 32509
1. yes, but do you really browse to your site with
http://somehost/localhost/htdocs/main1.php
only then it's correct.
2. well, you can add g2_view=core.ShowItem&g2_itemId=$id to the $_GET parameters in your script and then it will show this album...