Standalone?

spectre
spectre's picture

Joined: 2002-08-19
Posts: 5
Posted: Mon, 2002-08-19 17:40

The doc dosen't say how to setup for a standalone. Any help? Thanks.

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Tue, 2002-08-27 15:25

All you need to do is follow the setup instructions for the block-random.php script up to the point that it then goes on to discuss how to wrap the block in Nuke/PostNuke. Simply use an include in your site where you want the random image to show up.

<!--#include file="block-random.php" -->

or

<!--#include virtual="/gallery/block-random.php" -->

depending on where your script is. Of course this assumes you've got SSI capability on your site.

You can also have multiple instances of this. On my site, I've got at least two includes pointing to the script, and get two+ separate random image displays...nice! Hope that helps. :smile:

 
giorgiod

Joined: 2002-08-27
Posts: 4
Posted: Tue, 2002-08-27 16:54

Done ! I've placed these lines into my php page:

<?php
virtual ("/gallery/block-random.php");
?>

The index.php in the /gallery/ directory was modified with the addiction of the line block-random.php to the safe_to_include block.

But when I try to load the page I'll get these errors:

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/block-random.php on line 41

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/init.php on line 46

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/init.php on line 51

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/init.php on line 52

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/util.php on line 686

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/errors/unconfigured.php on line 1

Fatal error: Failed opening required 'errors/configure_instructions.php' (include_path='.:/usr/local/psa/apache/lib/php') in /usr/local/psa/home/vhosts/fuori/httpdocs/gallery/errors/unconfigured.php on line 1

Please what's wrong ?? :???:

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Tue, 2002-08-27 21:26

"Done ! I've placed these lines into my php page:
<?php
virtual ("/gallery/block-random.php");
?>
Please what's wrong ??"

Well, for starters, your function call. :roll: From the PHP.net site:

" virtual() is an Apache-specific function which is equivalent to <!--#include virtual...--> in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header. For PHP files, you need to use include() or require(); virtual() cannot be used to include a document which is itself a PHP file."

If you want to use a PHP include call then try
<?
include ("http://www.yoursite.com/gallery/block-random.php");
?>

Hope that helps :grin:

 
spectre
spectre's picture

Joined: 2002-08-19
Posts: 5
Posted: Wed, 2002-08-28 03:49
Quote:
... Simply use an include in your site where you want the random image to show up...

Thanks for the reply. I tried it and got some limited success. The first time I viewed the page it worked. After hitting refresh I got:

Warning: rand() expects parameter 2 to be long, string given in /home/blabal/www/forums/modules/gallery/block-random.php on line 138
ERROR: requested index [] out of bounds [204]
Fatal error: Call to a member function on a non-object in /home/blabla/www/forums/modules/gallery/classes/Album.php on line 570

I should mention that I am using the gallery integrated into phpBB2. Does that error look fixable?

Thanks again for the help.. :smile:

 
BiTurbo27t
BiTurbo27t's picture

Joined: 2002-08-27
Posts: 19
Posted: Wed, 2002-08-28 04:49
Quote:
I should mention that I am using the gallery integrated into phpBB2.

:eek: Oh. That does make a difference. You'll need to go to phpBB2's site then, and look for the hack to try to make it work. There's also a link here under the "Contributed Code" area on integrating Gallery into some of the blogs. I was using Post-Nuke for awhile, but there were too many problems getting the random block working...and very few blogs out there have hacks that attempt to get it to work. That's why I gave up on blogs for now. I don't need a "forum" for my small personal site and have found things to be much more reliable and customizable just using html, SSI's and PHP scripts on their own. More flexible too IMHO. Themes are still pretty much a nightmare with most of the current blogs too. YMMV.

Luck. :wink:

 
Suede

Joined: 2002-07-19
Posts: 5
Posted: Wed, 2002-08-28 18:05

spectre, you may already have this fixed.. but if you don't look at eilko's code in this thread:

http://gallery.menalto.com/modules.php?op=modload&amp;name=phpBB_14&amp;file=index&amp;action=viewtopic&amp;topic=191&amp;5

The error you are now getting is not phpbb.. its that php 4.2.2 want's trim() in the readcache function.. i was getting it to. Eilko's fix works :smile:

 
spectre
spectre's picture

Joined: 2002-08-19
Posts: 5
Posted: Thu, 2002-08-29 05:28

Suede, thanks much. That did it. :smile: Now I just need to figure how to get the links to open the gallery with the module.php instead of directly opening gallery. I found the code for the links but not sure how to modify it:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> ."<a href=" .makeAlbumUrl($album->fields["name"], $id) .">"
.$album->getThumbnailTag($index)
."</a>";</TD></TR></TABLE><!-- BBCode End -->
My links look like this:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> <a href="forums/modules.php?op=modload&amp;name=gallery&amp;file=index"</TD></TR></TABLE><!-- BBCode End -->
???

 
spectre
spectre's picture

Joined: 2002-08-19
Posts: 5
Posted: Thu, 2002-08-29 06:32

Ok, I adjusted my calling script in my home page to this:<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> <?
include ("http://www.my-site.net/forums/modules.php?op=modload&amp;name=gallery&amp;file=index&amp;include=block-random.php");
?> </TD></TR></TABLE><!-- BBCode End -->It displays fine but the link to the pic is missing the "forums" directory:

"http://www.my-site.net/modules.php?set_albumName=album01&amp;id=abg&amp;op=modload&amp;name=gallery&amp;file=index&amp;include=view_photo.php&amp;PHPSESSID=483a39191ed83b9281ac437cfe22da68"

???

 
spectre
spectre's picture

Joined: 2002-08-19
Posts: 5
Posted: Thu, 2002-08-29 18:30

Well I just manually added my phpbb root path to the link in the random block script and all is good :smile:.

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> echo "<br><center>From: "
."<a href=" . "forums/" . makeAlbumUrl($album->fields["name"]) .">"
.$album->fields["title"]
."</a></center>"; </TD></TR></TABLE><!-- BBCode End --> There may be a better way but hey not bad for a newbe eh? :wink:

 
Morty

Joined: 2003-08-12
Posts: 4
Posted: Sun, 2004-08-15 00:25
Quote:
Code:

<?

include ("http://www.my-site.net/forums/modules.php?op=modload&name=gallery&file=index&include=block-random.php");

?>

If I can make the note that you do not want the " in the code you quoted. It should be a single ('http........ .php'); not the way you have it with ("http.......php");

Other than that, thanks, you solved my problem with the linkage!

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Sun, 2004-08-15 00:30

There's no reason that single quotes are necessary, although they are (imperceptably) faster than double-quotes as long as there are no entities that need to be interpreted by PHP.