1

Topic: Image and page layout

Hellow there,

I've been searching and searching but I can't find where to change the following:

I need the PunBB forum to display in the same layout as the rest of my website. It's a page-centered table layout width 760. And the logo from the rest of my website's pages should be displayed in the forum pages as well... could be easy to modify, but I just can't find the right place.

Thanx for responses

Re: Image and page layout

Have a look at the files in include/templates/

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3

Re: Image and page layout

Allrighty, completely overlooked the template file :-s

Now I've set up the table width and center properties, everything looks ok but when I'm browsing the forum except for some pages like registering a new user or viewing a topic or post, the class="punmain" doesn't appear to count for pages like that. Any further help? Sorry for my stupidism :-) I'm more of a Photoshop freak than a sourcecoder but I need this forum to be ok...

Thanx for any help!

Re: Image and page layout

Hmm, odd. I don't really understand what you mean though. Could you perpaps take a few screenshots or give us a link to the board?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: Image and page layout

Board is to be found at http://www.unixcore.com/~dennis/punbb/index.php, take a look and see that when you just view the board everything concerning page layout is ok (width=760, align=center), but when you click on (for example) 'register' the page layout gets all mixed up... same problem trying to display a single topic, page layout gets messy. I can't find which .tpl file to modify therefor :-s I hope you understand my problem now, I don't know how to explain elsewise...

Thanx

6

Re: Image and page layout

Scriptweaver wrote:

Board is to be found at http://www.unixcore.com/~dennis/punbb/index.php, take a look and see that when you just view the board everything concerning page layout is ok (width=760, align=center), but when you click on (for example) 'register' the page layout gets all mixed up... same problem trying to display a single topic, page layout gets messy. I can't find which .tpl file to modify therefor :-s I hope you understand my problem now, I don't know how to explain elsewise...

Thanx

URL without the comma, off course...

Re: Image and page layout

Ah, I see. Why it turns out exactly like that I don't know. I do however, know of a better way to do what you want to do. Instead of editing the style sheet and entering a fixed width there (which will mess up the layout in other places), you should just "wrap" your hole content in another table. Like this:

http://punbb.org/stuff/sw.txt (save as or open and then view source)

Using the template above requires that you restore the style sheets to the way they looked when you installed the forum.

Edit: Grr. Bad URL.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

8

Re: Image and page layout

Pretty cool :-D works like a charm

Just one more thingy: how do you get something like 'recent discussions' on the first page of a website, linking automatically to the forum topic when clicked on? Djeez I really should consider buying a PHP manual once :-s

Re: Image and page layout

It's possible, but it's a little tricky. It will be much easier in 1.1 though. If you really want to give it a go, I recommend you read this topic: http://punbb.org/forums/viewtopic.php?id=2477

"Programming is like sex: one mistake and you have to support it for the rest of your life."

10 (edited by Grillcliff 2003-08-20 21:19)

Re: Image and page layout

Isn't it a little ungrateful to delete the copyright text at your discussion board? I mean, it's a free board and all the author asks for is a couple of small text strings at the bottom of the page ;-)

11

Re: Image and page layout

Could you show me how in 1.0.1? I don't know how long it will take to develop 1.1 and make this thing easier... I copied the code from the swedish post you referred to, but I'm getting sql connection errors in sock.mysql so I guess it seems to be referring to a local sql server which is not the case here... And my swedish is zero since I don't even live anywhere near that place :-D so I can't read what those guys are saying about it... Thanx in advance

Re: Image and page layout

First of all. Do you know any PHP? I could tell you how it's done, but if I have to "start from scratch", I'd rather not :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Image and page layout

I know some of it... I'd say: try to explain and I'll tell you which part I don't understand... ps- I've looked at the Dutch langfiles and I've corrected about ten grammatical mistakes, any interest for these corrected files? How can I send them best way to you?

Re: Image and page layout

About the dutch translation. Great! You can e-mail me the updated language pack. Don't forget to tell me what name you want me to enter in the credits.

About "Recent discussions". I'll tell you how it's done here on punbb.org.

My directory structure is as follows:

/home/www/site/ - this is where the website stuff is located
/home/www/forums/ - the forums (duh!)

My index.php for the website starts out like this:

<?php

// We add the forums directory to the PHP path so that PHP can find the scripts we include later
set_include_path(get_include_path().':../forums');

@include 'config.php';

// If PUN isn't defined, config.php is missing or corrupt
if (!defined('PUN'))
    exit('config.php doesn\'t exist or is corrupt. Please run install.php to install PunBB first.');

// The next line tells PunBB to not update the cookie of the visiting user
// A visit to the front page shouldn't affect stuff like new post indicators
define('PUN_DONT_UPDATE_COOKIE', 1);
require 'include/common.php';

After we have run this code we have access to $db, which is the database abstraction layer, $cookie, which holds information about the visiting users cookie, $cur_user, which is all the user information about the currently logged in visitor (the array isn't set if the visitor is a guest), $options, which is all the forum options and $permissions, which is well, the permissions :) Probably a few more variables, but there are the most interesting.

Please not that you have to alter the set_include_path()-line to reflect your own directory structure. You should change ../forums to the relative path to your forum directory.

After that code, I do a little bit of that and a little bit of that. Then, when it's time to display the "recent discussions", I run this code:

<?php

$result = $db->query('SELECT id, subject FROM '.$db->prefix.'topics WHERE moved_to IS NULL ORDER BY last_post DESC LIMIT 14') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

while ($cur_topic = $db->fetch_assoc($result))
{
    if ($options['censoring'] == '1')
        $cur_topic['subject'] = censor_words($cur_topic['subject']);

    if (strlen($cur_topic['subject']) > 30)
        $cur_topic['subject'] = trim(substr($cur_topic['subject'], 0, 24)).' ...';

    echo "\t\t\t\t\t\t\t".'<b>·</b> <a href="http://punbb.org/forums/viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a><br>'."\n";
}

?>

That should do it.

Another thing to note is that the above code will display recent topics from all forums, be they admin/mod only or not, regardless of whether the visitor has access to such forums or not.

Hope this helped!

Edit: I noticed you are running 1.0. You must upgrade to 1.0.1 for the above code to work correctly.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

15 (edited by Scriptweaver 2003-08-23 10:22)

Re: Image and page layout

I get this when I do what you say:

Fatal error: Call to undefined function: set_include_path() in /usr/home/dennis/public_html/index.php on line 5

Line 5 says: set_include_path(get_include_path().':../punbb'); because my directory structure is public_html/ for the website and public_html/punbb for the forum pages.

I may assume I've done something wrong... help?

Edit: does this error message have anything to do with the php server itself? php.ini is my first guess :-s but I'm not really into php, it's just a guess...

Re: Image and page layout

Ah, of course. Silly me! set_include_path() and get_include_path() were added in PHP 4.3.0. Here's an alternative that should work with older versions of PHP as well:

ini_set('include_path', ini_get('include_path').':../forums');

About the relative path to your forums directory. I believe it should be ./punbb and not ../punbb since:

. = current directory
.. = parent directory

In you case we want the directory punbb which is a subdirectory of the "website directory", so we don't need to go one step back like in my case. Are you following me?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Image and page layout

Completely :-)

OK seems to work, doing everything like I wanted it to do!
Great, thanx for the support!!

ps I've emailed you the updated language pack in Dutch. Hope you've got it right.

Dennis

Re: Image and page layout

Yes, I got it. I won't look at it until tomorrow though, since I just got back from a party with 20 danish people. I currently feel as I deserve :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Image and page layout

May I ask just one more thing... how many topics are actually displayed with this code? I'd like to display the last ten topics or so, and is it also possible to display the last ten POSTS instead of the topics in which they are posted?

20 (edited by Scriptweaver 2003-09-04 12:44)

Re: Image and page layout

Scriptweaver wrote:

May I ask just one more thing... how many topics are actually displayed with this code? I'd like to display the last ten topics or so, and is it also possible to display the last ten POSTS instead of the topics in which they are posted?

Damn, as always I found the answer two minutes after I post here... for info it's in 'topics WHERE moved_to IS NULL ORDER BY last_post DESC LIMIT 10' that last number is equal to the amount of posts you want to be displayed.

I'd still like to know how to display the actual posts instead of the topics in which they are posted though...

Re: Image and page layout

I'd still like to know how to display the actual posts instead of the topics in which they are posted though...

Anyone answer?

Re: Image and page layout

Can you wait 'til 1.1? :) Or maybe someone else can paste some code?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: Image and page layout

I think I may assume the difference is in the sql query? I'm gonna try something out myself, meantime if somebody knows the answer please post it here, anyway I can wait til 1.1 surely :-)

Re: Image and page layout

Is there any way to implent this to an .asp-file?

//Jocke

Re: Image and page layout

If you can connect to the database from an asp page, you can fetch this info... but you need to write the code probably a bit different as asp aint php