Topic: how to add php to the main site

got a nice script that displays an random picture from coppermine, now i just need to add it
to the mainsite. the problem is that the script has to be in the cpm rootdir. ( /coppermine/ )

best way is to use include command but i cant add php tags in the tpl-files and if i use pun_include
it only points to user dir. tryed to add a file (whit the include) to the user-folder and call it from pun_include
but it generates nothing, Please help me. im stuck

Re: how to add php to the main site

Use pun_include to a file in the user directory that simply includes your coppermine file relative to PUN_ROOT

Re: how to add php to the main site

create your php code name it test.php
now upload this into the include/user folder
nexted

open main.tpl

add this pun tag where ever you want it to show up
<pun_include "test.php">


that simple..

if you want to put it in a block style from punbb

name this as test.php

 <div class="block">
            <h2><span>test</span></h2>
            <div class="box">
                <div class="inbox">

                   you php code!

                </div>
            </div>
        </div>
My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: how to add php to the main site

i tried the include command. but it only returns a bland result, maybe im doing it wrong?

can some one help me? i suck att php smile

the path to the script is:
ROOT> coppermine/getphoto.php

5 (edited by johanz 2007-11-08 23:10)

Re: how to add php to the main site

Hmm no help?

i have done the part in the main.tpl pointing at the photo.php

and the photo.php have this include code:

<?php
include '/coppermine/showthumb.php';
?>

and still nothing, only an emty box were the thumbnail should be sad

showthumb.php works i can go to it directly, no problems showing a picture.

whats wrong?

6 (edited by quaker 2007-11-09 01:30)

Re: how to add php to the main site

ok ok.... here we go !
here is a standard main.tpl

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<pun_head>
</head>
<body>

<div id="punwrap">
<div id="pun<pun_page>" class="pun">

<div id="brdheader" class="block">
    <div class="box">
        <div id="brdtitle" class="inbox">
            <pun_title>
            <pun_desc>
        </div>
        <pun_navlinks>
        <pun_status>
    </div>
</div>

<pun_announcement>

<pun_main>

<pun_footer>

</div>
</div>

</body>
</html>

Now here what you will do!

create a folder called user place it in the include folder!!
/include/user

inside this folder you will place photo.php

create this called photo.php

<?php
include '/coppermine/showthumb.php';
?>

save this as photo.php inside the include/user folder
path: /include/user/photo.php

now open main .tpl
add this to where you want the images to show up!!!

<div class="block">
            <h2><span>test</span></h2>
            <div class="box">
                <div class="inbox">

                   <pun_include "photo.php">

                </div>
            </div>
        </div>

here what the main.tpl should look line!!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<pun_head>
</head>
<body>

<div id="punwrap">
<div id="pun<pun_page>" class="pun">

<div id="brdheader" class="block">
    <div class="box">
        <div id="brdtitle" class="inbox">
            <pun_title>
            <pun_desc>
        </div>
        <pun_navlinks>
        <pun_status>
    </div>
</div>

<pun_announcement>
<div class="block">
            <h2><span>test</span></h2>
            <div class="box">
                <div class="inbox">

                   <pun_include "photo.php">

                </div>
            </div>
        </div>
<pun_main>

<pun_footer>

</div>
</div>

</body>
</html>

that is it... simple !

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: how to add php to the main site

Thank for helping me, but it still renders a blank box.

i even tryied the externscript
<?PHP
include('http://www.bulleforum.se/extern.php?action=stats');
?>

and still its a freaking blank box...

Any suggestions whats wrong?