Visual Integration using gallery2 embedded
shocksll
Joined: 2005-06-22
Posts: 352 |
Posted: Tue, 2005-09-20 18:14 |
This is taken from this thread. http://gallery.menalto.com/node/36897 Valiant, is there anything wrong with doing it like it was embedded. That way they wouldn't have to mod any theme's. Something like below is what i'm thinking. Steve Lineberry |
|
Posts: 352
It seems to work as expected on my gallery2 test/demo site.
http://pictures.thelineberrys.com/gallery2/gallery2embedded.php
I just had to change my cookie path to / and delete my cookies.
Steve Lineberry
Posts: 32509
i wanted to keep the other thread simple = no programming, just HTML / templates. that's why.
IMO modding a theme is far less complicated than using GalleryEmbed.
embedPath should be '/gallery2/'
and
$g2_Config['embedUri'] = 'gallery2embedded.php';
you shouldn't have to tinker with the cookie path.
Posts: 352
using the users html that he posted in the other thread and my embed colorpack I was able to come up with this:
http://pictures.thelineberrys.com/gallery2/gallery2embeddedtravel.php
I had to remove the doctype because his header was getting all screwed up.
Steve Lineberry
Posts: 352
I guess I just feel like I see a lot of people asking how to get g2 inside their own site and I'm not sure if customizing the templates is the best way considering they will have to never change themes or add their own customization to every theme. And since they copied the theme.tpl into the local folder, any theme.tpl updates that are done won't get into their custom version when the upgrade. I was just asking if there is any downside to using embedding to accomplish the visual integration. My code above I feel like does visual integration only and provides all the same functionality that one can do in the standalone gallery2 (such as the login link).
Steve Lineberry
Posts: 32509
sorry, i didn't realize you wanted to help, i thought it was another question.
still, i think changing the look of a site in a single theme.tpl is a very intuitive concept. assembling the parts as in GalleryEmbed just for the visual integration is overkill IMO. also, you need to set paths and add some php code. for me it's fine, but for a designer, it would definitely be the more complicated method.
Posts: 352
Thanks for the tips in the change to the embedded code. I had to change the cookie path so I could still be logged in while in both standalone and my gallery2embedded.
Posts: 32509
btw: feel free to add your link to the codex.gallery2.org -> howtos page.
Posts: 352
Ok, that's cool. I was just suggesting this method because I feel like it makes more sense to the G1 users who are used to the wrapper.footer.default and wrapper.header.default. Where this is one place to add/change your header and footer for the whole site no matter what theme you use. So, is there any downside to using my code above for visual integration only?
Steve Lineberry
Posts: 352
It actually didn't work when I changed it to this. I had to change it back to /gallery2/gallery2embedded.php
Posts: 32509
downside? yes,
- you have to create a new file (not just a customized theme)
- you have to use PHP code and find out what paths you need
- there are suddenly two entry points to your G2, i guess most users don't want that
- the need to to something with cookie paths
Posts: 352
Ok, thanks for the response.
Steve Lineberry
Posts: 13451
Is there a reason why this is only kept in this thread, and not moved to a proper ( http://codex.gallery2.org/index.php/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode ) codex page?
h0bbel - Gallery Team
If you found my help useful, please consider donating to Gallery
http://h0bbel.p0ggel.org
Posts: 352
Ok, done. http://codex.gallery2.org/index.php/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode
Posts: 13451
Excellent! Thanks!
h0bbel - Gallery Team
If you found my help useful, please consider donating to Gallery
http://h0bbel.p0ggel.org
Posts: 1
Wonderful - just what i was looking for - slight problems though...
I get the following error "Notice: Undefined index: PHPSESSID in d:\apache group\apache\htdocs\gallery\gallery2embedded.php on line 14" which causes my css to not be rendered correctly - if i silence the error the css works fine but i am unable to use the cart feature, i have changed the cookie path and cleared them as instructed to no avail. I would appreciate your thoughts on what could be wrong ?
Many thanks
Pasty
Posts: 17
Hi shocksll,
Your gallery does not seem to be embedded in anything... Did you change it in the mean time?
I tried to apply your method, but unsuccessfully so far.
For one thing, when clicking on some links, there is a clash between the two headers:
Did you come across this problem too? Does anyone know how I can resolve this?
Posts: 352
You may not need that line where it assigns the session id to the gallery ID. That's only if you have auto start session on. Since you are receiving this error that means that you haven't started a sessions so there isn't an ID or that you've changed the name of your session ID variable and you should use that variable name instead of phpsessid. Check out your phpinfo to see the correct settings for your environment.
Steve Lineberry
Posts: 352
Yea, I think I took off the embedding for that site. You can still see it embedded at http://eclecticthreads.thelineberrys.com
To fix your error you need to turn output buffering on.
Posts: 17
Wow! This resolved the error, indeed!
Thank you very much, shocksll!
I have 2 more problems, which I suspect are related to the embedding, so I'll take the liberty to ask them within this thread.
1) When applying a certain frame style (like shadow for example) it does not reflect on the embedded site, although it works if not embedded. Do you happen to know why that may be?
2) The mod_rewrite does not work. Could this be related to embedding the gallery, or not really?
Posts: 352
Turns out it was embedded it just didn't look any different. I've change the text around it so you can tell that it's embedded but for the most part it still looks like the default.
Seems to work for me http://pictures.thelineberrys.com/gallery2/gallery2embedded.php?g2_view=core.ShowItem&g2_itemId=4156. What's your url?
mod_rewrite should work but you have to enable it from the embedded version of the site. You probably need to resetup your mod_rewrite module in order for it to use the new embedded url.
Posts: 17
It is http://www.sanparks.org/gallery/
Thanks for taking the trouble to look into this!
Posts: 352
Can you give me the url of a page that's supposed to have an image frame? Thanks.
Steve Lineberry
Posts: 17
Hi Steve,
I set the parent directories to have image frames - shadow.
Compare this (embedded):
http://www.sanparks.org/gallery/default.php?g2_view=core.ShowItem&g2_itemId=177
To this (not embedded):
http://www.sanparks.org/gallery/main.php?g2_view=core.ShowItem&g2_itemId=177
Thanks,
Nedret
Posts: 17
About mod_rewrite, I'll have to ask for help again.
This is what I did:
1. Re-installed the module mod_rewrite.
2. This is what I put in as .haccess path: /var/www/vhosts/sanp-staging/html/gallery/
3. This is what I put in as public path: /gallery
4. It gives me all Success when testing.
5. I copied /gallery/.htaccess file to /g1/albums/.htaccess
6. The rewrite does not work.
7. Here is the content of the .haccess file and I do not like what I see in there - the "/gallery//gallery/" part:
What am I missing? I'm getting crazy with this - having spent so much time on it without success...
Thanks, Steve!
Posts: 352
Can you post your default.php file?
Steve Lineberry
Posts: 17
Hi Steve,
Here is default.php:
Posts: 352
According to valiant above maybe you should try your embedpath to be default.php to try to get your rewrite working.
Also, the reason the shadows don't show up is you took out the whole head section of the gallery2embedded example I had. You need to add a
echo $g2moddata['headHtml'];
to the head section of your header file. And then you need to move your header file <? include($_SERVER['DOCUMENT_ROOT'].'/includes/header_2col.php'); ?>
down right above the echo $g2moddata['bodyHtml'];
Check out my example again and you'll see the stuff in the head that you must have deleted when you customized it for yourself.
Posts: 17
Unfortunately no luck here. Tried all kinds of combinations - it just does not work.
I'll try again tomorrow, as right now it feels like a dead end.
Yes! Yes! Yes!
This worked! It looks like my pain was self- inflicted.
Thank you for sticking with me so far! It feels great to sort things out thanks to your advice!
Nedret
Posts: 5
Hi I would need help..
I tried to do the embedding for my site, and tried to upload a few test files,
but it seems to show broken images link on my embedded page but it works perfectly on the usual site
Embedded: http://birds.com.sg/photo/gallery2embedded.php
Actual: http://birds.com.sg/photo/
Could anyone advise on the problem and solutions?
Thanks a million!
Posts: 352
You need to either turn off the urlrewrite or reconfig your urlrewrite while accessing your page from embedded mode.
Steve Lineberry
Posts: 5
Thanks a million!
I deactivate that module and it works..
Thanks you!
Posts: 5
Hi,
However, any problem I would like to ask. Instead of having the thumbnail image shown up, it got this funny image that pops up on the page. How can I make the thumbnail image appears instead of the strange image?
Posts: 352
Please start a new thread for this question. Thanks.
Steve Lineberry
Posts: 11
For anyone else who did not know what was meant by "turn output buffering on", it means you add a line to your php.ini file like this:
output_buffering=on
Posts: 11
"Fatal error: Call to a member function on a non-object in /home2/w3b4dm1n/public_html/gallery/gallery2embedded.php on line 34"
Posts: 11
oh sorry. line 34 is: if ($ret->isError())
Posts: 352
If you are using G2.1, you need to use the latest code posted http://codex.gallery2.org/index.php/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode
This is the location that I will make updates to the code.
Steve Lineberry
Posts: 11
How do I remove the navbar and basically everything but just the albums them selves?
http://www.cpsigmapi.org/gallery/gallery2embedded.php?g2_itemId=1113
Posts: 352
At http://codex.gallery2.org/index.php/Gallery2:Integration_Howto
There is some example code of not displaying the sidebar.
Add the line
right under the
Depending on what you want to remove, you might need to make your own theme or check out some of the ones here.
http://codex.gallery2.org/index.php/Gallery2:User_Contributions#Themes
You might be interested in my EclecticThreads theme http://gallery.menalto.com/node/39159 It's very minimal with no sidebar and you don't even have to add the GalleryCapabilities thing above.
If you don't want to see the gallery logo or the footer buttons uncomment the correct style in the gallery2embedded code or add this to your site's css file.
change
to
Steve Lineberry
Posts: 182
I get frustrated with themes as a general rule, because typically I just want to plunk the content into my own website design and not have it try to put in its own colors, backgrounds, etc. I made a theme for my G1 gallery on my website here: http://gallery.opalcat.com which I'm going to have to recreate for G2...ugh...
I was hoping to avoid having to create a whole new theme for a site I'm doing for a friend, but when I tried to embed it using the instructions, it works great when I view gallery2embedded.php, but as soon as I click on anything (album, whatever) it goes right back to the non-embedded version. Also, how can I get it to stop using a color pack? I don't want background colors or anything on it, I just want my background to show through! Here it is: http://reardonbuilders.com/gallery/gallery2embedded.php --you can see how stupid it looks with a white background and all of that (I don't want ANY color background).
Posts: 182
(oh, I already set color pack to "none" but that doesn't help)
Posts: 352
That's what my embed colorpack is for. Check out http://gallery.menalto.com/node/35451
Posts: 352
The reason your gallery keeps jumping out of being embedded is because you have the url rewrite module on and it looks like you configured it while not embedded. Resetup your urlrewrite while embedded to get the .htaccess file to use your gallery2embedded file. Check out the embedded version of my demo site using url rewrite.
http://pictures.thelineberrys.com/gallery2embedded.php
If you need it to work while embedded and not embedded and with urlrewrite for both, that takes a little more work but as you can see on my demo site I got it working. http://pictures.thelineberrys.com/gallery2/ The key was to move the gallery2embedded.php file to the root and change the top of my gallery2embedded.php to the following.
And in the urlrewrite setup while embedded I set the htaccess path to be the root of my website and I think I put a / for the path.
Steve Lineberry
Posts: 182
Wow, thanks! *goes off to try it*
Posts: 17
Hi shocksll,
I just did an upgrade to 2.1.1, which ran fine and displays results with main.php ok, but if I go to my embedded page - default.php, I get the following error:
Fatal error: Call to a member function isError() on a non-object in ...
which refers to this part:
if ($ret->isError())
{
print $ret->getAsHtml();
}
Would you happen to know why this may be?
Thanks!
Nedret
Posts: 5
I'm attempting this approach, as I'm a PHPer who's used to include() path issues (and don't mind figuring it out).
Problem is, that I can't find the embed.php file I apprently need to include. It doesn't seem to be in the cvs tree that I used at all.
Basically, my script dies here (for want of embed.php):
What am I missing?
Cheers,
J.
Posts: 352
You need to update to the latest code. Did you see my post above? http://gallery.menalto.com/node/36918#comment-182058
Posts: 352
embed.php should be in the root of your gallery2 installation. Along with main.php and index.php, etc. You might want to check to make sure you have uploaded all the files that came in the package. I just checked the minimal package and even it includes embed.php. You mentioned cvs, are you downloading latest code from cvs or are you downloading it as a package from http://codex.gallery2.org/index.php/Gallery2:Download#Packages
Posts: 5
I'm using a nightly off http://gallery.menalto.com/downloads. It is, afterall where the download link in the header points. main.php doesn't feature, either...
Cheers,
J.
Posts: 352
Can you send me the url to your site so I can check it out? Thanks.