First, thanks for this incredible software.
My situation is this, I have Gallery2 beta 2 up and running great. in my gallery2 I have a photo album and an art/portfolio album. I want to be able to have my normal Gallery2 install and be able to (From my home page) call just the art/portfolio section into a frame in my home page. I want the portfolio section when it is called up this way to not have a sidebar.
I wonder if this is possible.
Thanks for any help.
Posts: 32509
tomnel, I guess we can accomplish that with GalleryEmbed
first, I'd do it without frames.
if your homepage, (where the port folio section of G2 should show up) isn't php yet, make it a php site (just rename .html to .php).
Then, at the place where you want G2 to appear:
(see docs/EMBEDDING for the details)
Posts: 31
Thanks for your help, sorry for being such a newb. I have put the code you gave me in a new portfolio.php page and called it from the home page but it only displays text.
I am studying the EMBEDDING doc and will try to learn more.
Posts: 32509
change the line:
GalleryEmbed::init(array(...));
to
GalleryEmbed::init(array('embedUri' => 'portfolio.php', 'embedPath' => '', 'relativeG2Path' => './gallery2', 'activeUserId' => ''));
where I assume that portfolio.php is directly in the web root (domain.com/portfolio.php), else change the embedPath.
I also assume that G2 is installed in domain.com/gallery2/, else change relativeG2Path. you'll have to change the include() at the beginning too if G2 is not installed there.
and i haven't tested the code...
Posts: 31
I am getting this error now.
This is the code I have put in portfolio.php
It seems the line it is having trouble with is
print $g2data['bodyHtml'];
Posts: 1378
Hmmm are you trying to display a album in embedded mode then you should be looking at this G2 API function instead using the ID of the album..
Posts: 31
OK I found the error that was making the page not load, the page is loading now but there is no style/theme applied to the page just the thumbnails on a white page and basic black text. also, when I click on one of the albums it goes back to the default G2 page with the sidebar and everything. shouldn't it keep the settings of the first embedded page?
Thanks again
Posts: 31
Thanks ozgreg, however when I insert that code I am brought to the root of my G2 not the portfolio album. the G2 theme is still missing.
Posts: 32509
tomnel,
1. what's the itemId of the portfolio album?
2. relativeG2Path is wrong. you entered an absolute path.
- what's the url to portfolio.php
- what's the url to standalone G2?
i made assumptions about these values which are incorrect. please answer the questions, then i can make this script working.
this code still doesn't work, because of the wrong itemId and relativePath etc.
but it's more complete.
edit: i've updated the code. it works for me, but it might not be what you want. we'll see.
Posts: 31
100
tnel.net/v-web/gallery2/
or it can be
tnel.net/portfolio.php
if that is any easier.
tnel.net/v-web/gallery2
Thanks very much for the help.
Posts: 32509
then replace the lines with the following:
/* Path to embed.php of G2 */
$includePath = dirname(__FILE__) . '/gallery2/embed.php';
/* path in url to this script, i.e. for example.com/portfolio.php it would be '/'
* and for example.com/foo/bar.php it would be '/foo/' */
$embedPath = '/v-web/';
/* relativeG2Path is the relative path from portfolio to gallery 2 */
$relativeG2Path = './gallery2/';
/* ItemId of the item / album that should be shown */
$itemId = '100';
assuming that your portfolio.php is in tomnel.net/v-web/portfolio.php
remember that you don't have to include the css from G2, you can set your own css instead.
and you can change the look of G2 to match your portfolio.php page.
Posts: 31
I see, thanks very much for writing the code. this is probably all very simple for you guys but I am learning how to do this from scratch. the page is loading up! but I just have to learn how to call the css styling.
What about when clicking on an album from my new portfolio page, it goes back to the default G2 layout with sidebar etc...
Here is the page.
http://tomnel.net/v-web/gallery2/portfolio.php
Posts: 32509
tomnel, my code assumed you have the url rewrite module deactivated. in that case, it would would. try it yourself. i guess we could it also get to work with url rewrite enabled...
Posts: 31
Great! turned off url rewrite and it is working but would be nice to have rewrite on. only thing now is page is framed in white, do you know why by any chance?
also some of the text formatting is lost from the original page, the text is black and large instead of smaller and grey.
Thanks again.
Posts: 32509
i assumed the portfolio.php was in /v-web/ and not in /v-web/gallery2/
either move the file or change the paths
/* Path to embed.php of G2 */
$includePath = dirname(__FILE__) . '/embed.php';
/* path in url to this script, i.e. for example.com/portfolio.php it would be '/'
* and for example.com/foo/bar.php it would be '/foo/' */
$embedPath = '/v-web/gallery2';
/* relativeG2Path is the relative path from portfolio to gallery 2 */
$relativeG2Path = '';
Posts: 31
Here is an error, embed path needs to be '/gallery2' to load the main portfolio page however the links to the albums no longer work unless the embed path is '/v-web/gallery2' but when I set it to that the formatting and the thumbnails no longer load.
Posts: 32509
if you have the file at
http://tomnel.net/v-web/gallery2/portfolio.php
embedPath:
then the path to the file is '/v-web/gallery2/'. this is the embedPath.
relativeG2Path:
the path from http://tomnel.net/v-web/gallery2/ to http://tomnel.net/v-web/gallery2/
this is '' = relativeG2Path
Posts: 32509
if you have further questions, please post your current source (or just the top section where the paths are defined).
Posts: 31
Link to page
http://tomnel.net/v-web/gallery2/portfolio.php
Posts: 32509
your embedPath is wrong. as i said, set it to '/v-web/gallery2'.
your relativeG2Path is wrong, set it to ''.
Posts: 31
Thanks, it works now.