Topic: extern and include question

Hi!

I dont get the extern and include to work. Just getting alot of errors. A while a go I had php4 on the server and now I got php5 and it doenst seem to work anymore.

Is there an other way to get the last topics, posts etc without using the extern.php?

Re: extern and include question

do u want something like this.

http://punlancer.com/index.php

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: extern and include question

staffanl wrote:

Hi!

I dont get the extern and include to work. Just getting alot of errors. A while a go I had php4 on the server and now I got php5 and it doenst seem to work anymore.

Is there an other way to get the last topics, posts etc without using the extern.php?

Yes, you can query them directly them from the database using sql, and display them yourself.

But maybe if you post more information about your problem somebody can tell you how to fix it. What exactly happens?

Re: extern and include question

I want it to be displayed in the sidebar of my miniportal.


quaker wrote:

do u want something like this.

http://punlancer.com/index.php

Q

I want to put the recent topics, posts etc in a box under your "links" for example. I only want the recent topics to be displayed under each other like your links. I think u have used the mod_active_topics_1.2 and that script works fine for me. But thats not what I need here, only the headlines of each topic.

pedrotuga wrote:

Yes, you can query them directly them from the database using sql, and display them yourself.

But maybe if you post more information about your problem somebody can tell you how to fix it. What exactly happens?

I have done this:

//in main.tpl
<pun_include "active_topics.php">
// in include/user/active_topics.php
<?php
include('http://127.0.0.1/extern.php?action=new&show=10&fid=1');
?>

What happens is that I get an error:

Warning: include() [function.include]: URL file-access is disabled in the server configuration in ...

Warning: include(http://127.0.0.1/extern.php?action=new&show=10&fid=1) [function.include]: failed to open stream: no suitable wrapper could be found in

Failed opening 'http://127.0.0.1/extern.php?action=new&show=10&fid=1' for inclusion (include_path=....

Re: extern and include question

quaker wrote:

do u want something like this.

http://punlancer.com/index.php

Q

check the left sidebar!

http://bunpai.com/index.php

Re: extern and include question

no one knows?

Re: extern and include question

do u want that code for recent topics? but it does not use extern.php!



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: extern and include question

here you go..

place this in a php file in the include/user folder
mine called test5.php
now go to the main.tpl and add the pun_tag.

<div class="block">
        <h2 class="block2">Recent Post</h2>
        <div class="box">
            <div class="inbox">
             <pun_include "test5.php">       
            </div>
        </div>
    </div>
<?php

showRecent(10); // Set amount of posts to be displayed here

function showRecent($show=5) {
    global $lang_common, $db, $pun_config, $db_prefix;

    $order_by = 't.last_post';
    $forum_sql = '';

//$show = isset($_GET['show']) ? intval($_GET['show']) : 5;
        //if ($show < 1 || $show > 50) $show = 5;

$trunc_len = 30; // Set amount of text to be displayed in subject.

// Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());


    
    
            while ($cur_topic = $db->fetch_assoc($result)) {
        if ($pun_config['o_censoring'] == '1')
     $cur_topic['subject'] = censor_words($cur_topic['subject']);
    $subject_truncated = pun_htmlspecialchars($cur_topic['subject']);
 



    echo '<li>  »<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.substr($cur_topic['subject'], 0, $trunc_len).'</a>...'."\n";
    }
    echo '</li>';
    return;
}
?>
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: extern and include question

quaker wrote:

here you go..

place this in a php file in the include/user folder
mine called test5.php
now go to the main.tpl and add the pun_tag.

<div class="block">
        <h2 class="block2">Recent Post</h2>
        <div class="box">
            <div class="inbox">
             <pun_include "test5.php">       
            </div>
        </div>
    </div>
<?php

showRecent(10); // Set amount of posts to be displayed here

function showRecent($show=5) {
    global $lang_common, $db, $pun_config, $db_prefix;

    $order_by = 't.last_post';
    $forum_sql = '';

//$show = isset($_GET['show']) ? intval($_GET['show']) : 5;
        //if ($show < 1 || $show > 50) $show = 5;

$trunc_len = 30; // Set amount of text to be displayed in subject.

// Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());


    
    
            while ($cur_topic = $db->fetch_assoc($result)) {
        if ($pun_config['o_censoring'] == '1')
     $cur_topic['subject'] = censor_words($cur_topic['subject']);
    $subject_truncated = pun_htmlspecialchars($cur_topic['subject']);
 



    echo '<li>  »<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.pun_htmlspecialchars($cur_topic['subject']).'">'.substr($cur_topic['subject'], 0, $trunc_len).'</a>...'."\n";
    }
    echo '</li>';
    return;
}
?>

GREAT! Works fine!


Just wonder.. How do I add the time when its posted <?php echo format_time($cur_post['posted']) ?>??


Is it possible to add something like this:?

if post < 20 chars add ... after the line.

10 (edited by MattF 2007-11-17 11:20)

Re: extern and include question

If you do a search for Quaker and Bingiman's frontpage index mod, that includes subject/message truncation and all the other gubbins.

11

Re: extern and include question

or u can go to http://punlancer.com and lookin the forum i explain how i did the portal.tpl and a index page with a side navbar and i give my index.php in there as well!

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 !!!