[SOLVED] External Image Block link problem

chadf

Joined: 2005-04-03
Posts: 7
Posted: Sun, 2005-04-03 04:20

I have successfully embedded G2 into my personal website. Today I tried to add an External Random Photo Image Block to my homepage and I have a problem. If I click on the random photo, it does not use my embedUri or path. It opens up another window, directly accessing g2 as if it were standalone. Is there a way to change this or even remove the hyperlink altogether? I would preferably like for the embedded page to load with the appropriate photo, and for it load in the same window.

For example:
My homepage is located at www.mysite.com/project4.
My embedded gallery2 page is accessed via www.mysite.com/project4/index.php?page=photos.
Clicking on the random photo on my homepage calls up www.mysite.com/gallery2/main.php?.....

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2005-04-03 06:22

i think valiant may have fixed this just a day or 2 ago.. get the very latest code and give it a try.. valiant can give more details.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-03 11:04

- get the latest nightly snapshot (/or the current cvs version).
- settings for GalleryEmbed::init call:
embedUri => 'index.php/?page=photos'
embedPath => '/project4'
realtiveG2Path => 'gallery2' (i guess, can't tell you that based on the information you gave us)

 
chadf

Joined: 2005-04-03
Posts: 7
Posted: Sun, 2005-04-03 19:54

I tried what you suggested and it still behaves the same way. The embedded gallery2 page works fine, but the random photos on my homepage still link directly to the gallery2 stand-alone directory. For now, you can view the site at: [url]www.fikesonline.com/project4[/url]. I am using today's version of the code (April 3rd), and below is my GalleryEmbed::init command:

  $ret = GalleryEmbed::init(array(
           'embedUri' => 'index.php?page=photos', 'embedPath' => '/project4', 'relativeG2Path' => '../gallery2', 'loginRedirect' => '/project4',
           'activeUserId' => ''));
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-03 20:26

I guess there's a misunderstanding here. for the random image blocks, you can't use the <?php @readfile('http://www.fikesonline.com/gallery2/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_show=title'); ?>
way of imageblocks in index.php?page=home if you want it to link to the embedded G2. You have to use
1. GalleryEmbed::init
2. GalleryEmbed::getImageBlock (not sure about the function name, but you get the idea),
3. GalleryEmbed::done
even for the index.php?page=home page.

and if you already do this, please post the sourcecode of your index.php?page=home page, such that i can see where the problem is.

ps: loginRedirect should be 'index.php?page=home' in your case. or just ''.

 
chadf

Joined: 2005-04-03
Posts: 7
Posted: Sun, 2005-04-03 22:10

Do you mean I should use something like this?

$ret = GalleryEmbed::init();
list($ret, $content) = galleryEmbed::getImageBlock(array('blocks'=>'randomImage','show'=>'title'));
if ($ret->isError()) { echo "Error"; }
echo $content;
$ret = GalleryEmbed::done();

So far I cannot get this to work at all.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-03 22:46

yes, exactly. only, use it with correct params, not just "init()".

require_once('../gallery2/embed.php');
$ret = GalleryEmbed::init(array('embedUri' => 'index.php?page=photos',
				    'embedPath' => '/project4',
				    'relativeG2Path' => '../gallery2',
				    'loginRedirect' => '',
				    'activeUserId' => null); // change this
list ($ret, $imageBlockHtml) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage', 'show' => 'title'));
GalleryEmbed::done();
 
chadf

Joined: 2005-04-03
Posts: 7
Posted: Mon, 2005-04-04 01:52

Thanks for all the help. I finally got it working. For some reason, I had to move the code further up in my file to get it to work. I think it may have been conflicting with another php database script I was using.

 
chadf

Joined: 2005-04-03
Posts: 7
Posted: Tue, 2005-04-05 05:53

Now my question is:
How do I get image frames to work with the random image blocks on my homepage?

 
rogermh

Joined: 2005-01-09
Posts: 102
Posted: Tue, 2005-04-05 14:14