| Author |
Message |
Curbob
Beginner


Joined: Oct 27, 2006 Posts: 8
|
Posted: Thu Jan 03, 2008 11:48 am Post subject: Random Block on seperate page |
|
|
I have an index.html front page and phpbb in a forums dir and gallery 2 in a gallery dir. What I wanted to do is pull a couple random images from the gallery and place them in the index.html.
I tried the:
Code: ›
<?php @readfile('http://www.usaoffroading.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
I also tried linking to the embeded gallery:
Code: ›
<?php @readfile('http://www.usaoffroading.com/forums/gallery2.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
but nothing is showing up. Does anyone have this working, is it because gallery is embeded or do I have something incorrect?
and what would be the best way to test for errors? firebug on firefox?
Thanks
Richard |
|
| Back to top |
|
|
AdBot
|
| Post subject: Random Block on seperate page |
|
|
|
|
|
| Back to top |
|
 |
Curbob
Beginner


Joined: Oct 27, 2006 Posts: 8
|
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 955
|
|
| Back to top |
|
|
Curbob
Beginner


Joined: Oct 27, 2006 Posts: 8
|
Posted: Fri Jan 04, 2008 2:25 pm Post subject: Re: Random Block on seperate page |
|
|
that worked great! thanks
just FYI for anyone doing this, It still wouldn't work using index.html but copied it as index.php and it all worked fine
Thanks again! |
|
| Back to top |
|
|
2KLiX
Beginner


Joined: Aug 03, 2008 Posts: 4
|
Posted: Thu Sep 25, 2008 4:47 am Post subject: Re: Random Block on seperate page |
|
|
I am trying to get this image block to work on my phpbb3 forum but don't know exactly how to edit the paths correctly. Could anyone help me get these sorted.
Thanks
Matt |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 955
|
Posted: Thu Sep 25, 2008 9:07 am Post subject: Re: Random Block on seperate page |
|
|
What paths?
Here is the basic code to put 4 random images across the top of your forum:Code: › Open styles/prosilver/overall_header.html
Find:
<!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) -->
<div id="message" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}:</strong> {L_BOARD_DISABLED}
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
Replace With:
<!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) -->
<div id="message" class="rules">
<div class="inner"><span class="corners-top"><span></span></span>
<strong>{L_INFORMATION}:</strong> {L_BOARD_DISABLED}
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ELSEIF not S_GALLERY2 -->
<div class="navbar">
<div class="inner"><span class="corners-top"><span></span></span>
<div style="text-align: center;">{G2_IMAGES}</div>
<span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
Open includes/functions.php
Find:
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
Replace With:
if (!empty($config['g2i_fullPath']) && !empty($config['g2i_embedUri']) && !empty($config['g2i_g2Uri']) && !empty($config['g2i_activeAdminId']))
{
require_once($phpbb_root_path . 'g2helper.' . $phpEx);
$g2h = new g2helper();
$g2_images = trim(str_replace(array('<div class="one-image">', '</div>'), array('', ''), $g2h->fetchImageBlock($user)));
}
else
{
$g2_images = $user->lang['OBTAIN_SETTINGS_FAILED'];
}
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'G2_IMAGES' => $g2_images,
'SITENAME' => $config['sitename'],
Open g2helper.php
Find:
}
?>
Before, Add:
function fetchImageBlock($user)
{
$this->init($user);
list ($ret, $g2_images) = GalleryEmbed::getImageBlock(array('blocks' => 'randomImage|randomImage|randomImage|randomImage', 'show' => 'none'));
if (isset($ret))
{
trigger_error('getImageBlock error' . $user->lang['G2_ERROR'] . $ret->getAsHtml(), E_USER_ERROR);
}
$this->done();
return $g2_images;
} |
|
| Back to top |
|
|
PoPoutdoor
Guru


Joined: Jan 20, 2006 Posts: 65
|
Posted: Fri Sep 26, 2008 12:43 am Post subject: Re: Random Block on seperate page |
|
|
Good! I can add g2 Image block to the portal page with this  |
|
| Back to top |
|
|
jettyrat
Moderator


Joined: Nov 28, 2005 Posts: 955
|
Posted: Fri Sep 26, 2008 12:46 pm Post subject: Re: Random Block on seperate page |
|
|
If you want the images to display vertically (side panel, etc.), take out the code that does a str_replace on the div class and just use the output from $g2h->fetchImageBlock() as is.
(You can also modify the css file instead of using the str_replace to get the images horizontal, as the gallery codex suggests.) |
|
| Back to top |
|
|
|
|
|
|
|