1 (edited by Shine 2005-11-16 09:54)

Topic: Some Newbie How-To's Questions

To be honest, I am getting lost within all the different forums/categories and docu's. Despite using the search and surfing&reading around, somehow I cannot seem to find what I am looking for .. or otherwise don't understand the given explanation(s).
Therefore I am going to ask my questions within this topic, with hope to get some understandable newbie help.


1). How-To: Adding Sidebar:
I managed to realise the sidebar tutorial (part 2). The only thing I cannot seem to realise and don't understand is how I can get to show the last 10-15 posts within a same sidebar block. These posts needs to be forum id independent. Actually same as seen on http://punbb.org/ ,  but now within the forumsidebar itself.
The only thing I know I've to put within main.tpl another block. But that's about it.

<div class="block">
        <h2 class="block2"><span>Recent Posts</span></h2>
        <div class="box">
        [i]What to do and put here to get them showed?[/i]
        </div>
</div>

Which code has to be applies within other files, I haven't a clue.



2). How-To: Implement own page?
Within that same tutorial I see at the end: New page template.
Great, but I haven't a clue what I should do with it. What does this template do? Where to upload it and call it within a link.
Question: How do I create my own page and implement this page within the forum lay-out as stated above (miniportal part 2) and call it up with a link?



I hope somebody can help this newbie step by step on these questions.

Grtz., Shine

Re: Some Newbie How-To's Questions

1. Check out extern.php
2. You would add the link to the navbar on top using the Additional Navlinks. The "template", I assume, is the basic structure of the page: you just fill it with data

3 (edited by Shine 2005-11-16 13:30)

Re: Some Newbie How-To's Questions

I had checked extern.php. already and this piece of code works as long it concerns another website. (have it active on another website, no problems)  But this extern code doesn't work within the forum itself.
When I put:

<? include('http://mywebsite/forums/extern.php?action=new'); ?>

within the new created sidebar block within the forum it doesn't show me anything.

<div class="block">
        <h2 class="block2"><span>Recent Posts</span></h2>
        <div class="box">
        <? include('http://mywebsite.com/extern.php?action=new'); ?>
        </div>
</div>

Obviously I am doing something wrong but cannot figure out what.



2. You would add the link to the navbar on top using the Additional Navlinks. The "template", I assume, is the basic structure of the page: you just fill it with data

Where do I have to put the newpage.tpl file?
I know how to add a text within the navbar from the adminsettings. But how do I call the template page up? < a href=" ?????? ">   so it shows the page? How should the link look like?

Grtz., Shine

4

Re: Some Newbie How-To's Questions

Shine wrote:

IObviously I am doing something wrong but cannot figure out what.

Ask your host if they have blocked including remote files.


Shine wrote:

Where do I have to put the newpage.tpl file?
I know how to add a text within the navbar from the adminsettings. But how do I call the template page up? < a href=" ?????? ">   so it shows the page? How should the link look like?

What link?

If you want to use a different template (newpage.tpl) upload it to the /include/template folder.

Then alter header.php a bit:

// Load the template
if (defined('PUN_ADMIN_CONSOLE'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/admin.tpl');
else if (defined('PUN_HELP'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/help.tpl');
else if (defined('PUN_NEWPAGE'))
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/newpage.tpl');
else
    $tpl_main = file_get_contents(PUN_ROOT.'include/template/main.tpl');

Then in your newpage.php add:

define('PUN_NEWPAGE', 1);

Re: Some Newbie How-To's Questions

Elzar wrote:
Shine wrote:

IObviously I am doing something wrong but cannot figure out what.

Ask your host if they have blocked including remote files.

I don't believe my host blocks this, and I have the same problem. Is there another way to do this because I am having the same problem as Shine.

Re: Some Newbie How-To's Questions

Check phpinfo(), see if allow_url_fopen is enabled

7

Re: Some Newbie How-To's Questions

Smartys&Elzar wrote:

Check phpinfo(), see if allow_url_fopen is enabled
Ask your host if they have blocked including remote files.

Yes it is open. Punbbforum and the website I am talking about are on the same webhoster with the same environments. The include part as mentioned below (extern.php) works within the website without any flaws. So the problem has to be somthing else. If I look around several topics, I see more users stumble into the same problem I encouter.
Isn't there another work around to accomplish this piece of work?

Thanks for the given support and explanation(s) considering the page question. I'm gonna fuzz the upcoming couple of days and see where it brings me! smile

Grtz., Shine

8

Re: Some Newbie How-To's Questions

Nobody has an answer to my first question? :
How to realise to show the last 10-15 posts within a sidebar block within the forum itself. Actually the same as seen on http://punbb.org/ ,  but now within the forumsidebar itself. ??


The extern.php include code doesn't work within the forum itself and allow_url_fopen is enabled.
Any suggestions?

Grtz., Shine

Re: Some Newbie How-To's Questions

Shine wrote:

Nobody has an answer to my first question? :
How to realise to show the last 10-15 posts within a sidebar block within the forum itself. Actually the same as seen on http://punbb.org/ ,  but now within the forumsidebar itself. ??


The extern.php include code doesn't work within the forum itself and allow_url_fopen is enabled.
Any suggestions?

Grtz., Shine

It does work though
The fact that it doesn't work for you doesn't make it any less correct wink
extern.php is what Rickard uses for the homepage.

Now then, can I have the REAL URL to extern.php and the real URL to the page you're calling it from?
And php short tags are allowed by your hosting company, aren't they?

10

Re: Some Newbie How-To's Questions

There's a file called rss.php that does the same thing, do a search on the forum.

It has been changed and enhanced over time by Alex King and others, I use it on my blog.

Re: Some Newbie How-To's Questions

hcgtv wrote:

There's a file called rss.php that does the same thing, do a search on the forum.

It has been changed and enhanced over time by Alex King and others, I use it on my blog.

How is it you use rss.php to output straight text instead of an RSS feed?

12

Re: Some Newbie How-To's Questions

ashiver wrote:

How is it you use rss.php to output straight text instead of an RSS feed?

Here is the topic: http://punbb.org/forums/viewtopic.php?id=6586 - it might explain some things.

Re: Some Newbie How-To's Questions

For those still having trouble, I finally figured it out.

the code should be:

<?
include ('http:www.site.com/forum/extern.php?action=active');
?>

but the trick which no one mentioned was the fact that your index.html page should be changed to index.php
that'll do it.

14

Re: Some Newbie How-To's Questions

ashiver wrote:

For those still having trouble, I finally figured it out. The code should be:
<?
include ('http:www.site.com/forum/extern.php?action=active');
?>
but the trick which no one mentioned was the fact that your index.html page should be changed to index.php
that'll do it.

Nono,.......you are misunderstanding the thing I want.

The way you've included the 'show recent topic' does also works for me, as long this concerns a standalone website/webpage outside the punBB forum.!!

The problem I encounter is how to include this recent topics block WITHIN the forum itself. If I use this include extern.php or RSS function it doesn't work.

The fact that it doesn't work for you doesn't make it any less correct extern.php is what Rickard uses for the homepage.

If I use it on my homepage, which remains within a different folder, this function works also correct. Point is, how to get this function also work WITHIN the forum (forumdirectory) itself. Putting up a sidebar within the forum to get an overview of recent posted topics.

Let me give you an example:
If you surf to: http://www.adoptietrefpunt.nl/forumbord/
you'll see on the left a block which shows an overview of recent done postings. This block is held within the forumscript and directory itself. And this is exactly what I would like to realise.
Now if you surf to: http://www.kunstpodium.com/portaal/ (it's a testpage made with CMS Xoops) you'll see I've included the extern.php within a block of that website and it works. If you click on a topic within that block you get tranfered to another directory: http://www.kunstpodium.com/punbbforum   the place where the forum is held.
Within the punbbforum you see on your left some blocks. (realised with part 2 of doku:http://www.punres.org/doku.php?id=tutorials:miniportal#part_2:adding_a_sidebar)
The last block is the one with the header 'recent'.  How do I get here always the last posted forum topics visible? If I make use of the extern.php (include funtion) it doesn't work.

Hope you now understand in what I mean. smile

Grtz., Shine

Re: Some Newbie How-To's Questions

    <div class="block">
        <h2 class="block2"><span>Recent</span></h2>
        <div class="box">
            <div class="inbox">
                <?php include('http://www.kunstpodium.com/forums/extern.php?action=new'); ?>      
            </div>
        </div>
    </div>

That's what I see when I view source. In other words, your PHP tag is being parsed as HTML

16

Re: Some Newbie How-To's Questions

Smartys wrote:
    <div class="block">
        <h2 class="block2"><span>Recent</span></h2>
        <div class="box">
            <div class="inbox">
                <?php include('http://www.kunstpodium.com/forums/extern.php?action=new'); ?>      
            </div>
        </div>
    </div>

That's what I see when I view source. In other words, your PHP tag is being parsed as HTML

Great, now what do I have to do to parse it the good way, so topics show up in recent block?

17

Re: Some Newbie How-To's Questions

I was looking at doing the same thing..

Found it for you..

Connorhd wrote:

unfortunatly you can't just use pun_include

to add a latest posts block you could do this as long as you don't use pun_include already:

open footer.php

replace

// START SUBST - <pun_include "*">
while (preg_match('/<pun_include "(.*?)">/', $tpl_main, $cur_include))
{
    ob_start();
    include PUN_ROOT.$cur_include[1];
    $tpl_temp = ob_get_contents();
    $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
    ob_end_clean();
}
// END SUBST - <pun_include "*">

with

// START SUBST - <pun_include "*">
while (preg_match('/<pun_include "(.*?)">/', $tpl_main, $cur_include))
{
    ob_start();
    include $cur_include[1];
    $tpl_temp = ob_get_contents();
    $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
    ob_end_clean();
}
// END SUBST - <pun_include "*">

you can then use

    <div class="block">
        <h2 class="block2"><span>Latest Posts</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
                    <pun_include "http://yoursite.com/forum/extern.php?action=active">
                </ul>        
            </div>
        </div>
    </div>

in main.tpl remember to change the extern.php url