Random Block & Movabletype integration

dreadpiratemark

Joined: 2003-06-08
Posts: 1
Posted: Mon, 2003-06-09 00:09

This is starting to drive me nuts. I've searched & searched trying to learn how to integrate the Random Block info from Gallery into MovableType. I'd like to have a random picture appear on the index page of MovableType when people load my site & I thought that Random Block was the answer...but I can't make it work.

I have Random block working right when you go directly to: http://www.markroberts.org/gallery/block-random.php

The problem comes trying to get it to appear in the left column of my blog. I've used the following html, to no avail:

<!-- Random Picture-->
<div class="colhead">Random Gallery Picture</div>
<div class="blocks2">
<div class="side">
<?php include("../gallery/block-random.php"); ?>
</div>

I've also tried using <?php include("http://www.markroberts.org/gallery/block-random.php"); ?> as the path, but that didn't work either. In slight desperation I tried just dumping it with an <img src="../gallery/block-random.php"> html, but of course that didn't work.

So, sorry for the newbie question...but why can't I make this work (::cough, besides the obvious PEBKAC issues, cough::)? I'm happy to provide more info if you need it...

TIA
Mark

TIA

 
nsabine

Joined: 2003-11-21
Posts: 3
Posted: Mon, 2003-11-24 14:54

1. Leave random-block.php in your gallery directory.

2. create a new template module, I called it "firstline". (not an index template -- template modules are the last set on the templates screen)

3. add this code to the template:

<?php
global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_BASEDIR;
global $GALLERY_NO_SESSIONS;
$GALLERY_EMBEDDED_INSIDE = "mt";
$GALLERY_BASEDIR = "/path/to/gallery/";
$GALLERY_NO_SESSIONS = true;
?>

4. add this code to the top of the Main Index, the Master Archive Index, and each of your Archive-Related templates:

<$MTInclude module="firstline"$>

5. add the php code to import the random-block.php file where ever you want the random photo to appear:

<?php include ("/path/to/gallery/block-random.php"); ?>

Hope it helps

-Nick
http://www.esabine.net

 
jclowers
jclowers's picture

Joined: 2003-12-02
Posts: 3
Posted: Tue, 2003-12-02 22:32

Nick,

I have tried the above and for some reason it doesn't show up. Now when I view the source of my web page it shows the <?php... (etc) ?> all of the source and doesn't seem to excute the PHP? is there something that you can think of I am doing wrong.

Website - http://www.clowersfamily.com
block-random - http://www.clowersfamily.com/gallery/block-random.php

Thanks in advance,
Jeff

 
nsabine

Joined: 2003-11-21
Posts: 3
Posted: Tue, 2003-12-02 22:53

your php code is not getting executed because it is contained within a .html file instead of .php

(you can tell by viewing the source - if you can still see the php code, then it didn't get executed)

to change index.html to index.php:
log in to movable type
go to templates -> main index
change your output file from "index.html" to "index.php"
rebuild
delete index.html from your server

that should do it!

 
jclowers
jclowers's picture

Joined: 2003-12-02
Posts: 3
Posted: Wed, 2003-12-03 19:58

Perfect. I had thought it was something like that, it didn't seem to execute it was just there. I am a novice at this these days, things were easier pre-java / etc... and text editors were my only .html editing resource... :) I need to catch up with the times.

Thanks,
Jeff

 
djudd

Joined: 2003-12-13
Posts: 7
Posted: Thu, 2003-12-18 06:18

Nsabine,
Thanks, I had the same issue as jclowers and your solution worked perfectly!
Thanks again!

 
jdphilli

Joined: 2002-08-30
Posts: 9
Posted: Thu, 2004-01-08 02:56

I have tried this solution myself and I get the following error:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 28832 bytes) in /.../gallery/util.php on line 342

Do you have ideas about what this means?

 
linton

Joined: 2002-10-12
Posts: 42
Posted: Wed, 2004-01-14 23:39

Can someone tell me where to get the stand alone version of this? I have been looking but i can't find it!