Forum includen? (German / Deutsch)

by apfelsino, Friday, March 04, 2011, 14:40 (4805 days ago)

Gibt es eine Möglichkeit das Forum per include in die Homepage einzubauen?
Ich habe das Forum im Ordnuner /forum/ liegen und rufe die Seiten per "index.php?seite=forum" auf.

Wenn ich jetzt die index.php include, erhalte ich folgende Error-Meldungen:

"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at index.php:9) in /forum/index.php on line 29

Warning: Smarty error: unable to read resource: "german.lang" in /forum/modules/smarty/Smarty.class.php on line 1093

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 205

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 207

Warning: Smarty error: unable to read resource: "default/main.tpl" in /forum/modules/smarty/Smarty.class.php on line 1093"

Gibt es da überhaupt eine Möglichkeit mit einem include? Oder könnte ich das Forum z.B. nur als iframe direkt in die Seite einbauen?

Avatar

Forum includen?

by Auge ⌂, Saturday, March 05, 2011, 11:23 (4804 days ago) @ apfelsino

Hallo

Gibt es eine Möglichkeit das Forum per include in die Homepage einzubauen?

Nein.

Ich habe das Forum im Ordnuner /forum/ liegen und rufe die Seiten per "index.php?seite=forum" auf.

Wenn ich jetzt die index.php include, erhalte ich folgende Error-Meldungen:

"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at index.php:9) in /forum/index.php on line 29

Warning: Smarty error: unable to read resource: "german.lang" in /forum/modules/smarty/Smarty.class.php on line 1093

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 205

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 207

Warning: Smarty error: unable to read resource: "default/main.tpl" in /forum/modules/smarty/Smarty.class.php on line 1093"

Das sind alles Folgefehler deines Include-Versuchs.

Gibt es da überhaupt eine Möglichkeit mit einem include? Oder könnte ich das Forum z.B. nur als iframe direkt in die Seite einbauen?

Als iframe müsste es klappen. Was hindert dich, es auszuprobieren?

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Yes, with Apache mod_rewrite and an .htaccess file

by Matthew Kastor, Saturday, March 05, 2011, 17:11 (4804 days ago) @ apfelsino
edited by Matthew Kastor, Saturday, March 05, 2011, 18:03

Apache mod_rewrite

If you're on an Apache server then you can make a rewrite rule so that when someone tries to visit http://yoursite.com/ Apache would grab the files from http://yoursite.com/forum/

Detailed instructions:
http://httpd.apache.org/docs/current/mod/mod_rewrite.html

This is similar to the rewrite rule you'll need:
http://howto.kryl.info/mod_rewrite/#subdir-as-root

Then you could set up your forum without changing anything.

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !subdir/
RewriteRule (.*) http://example.com/subdir/$1 [L]
</IfModule>

Yes, using PHP's header function to redirect visitors

by Matthew Kastor, Saturday, March 05, 2011, 17:53 (4804 days ago) @ apfelsino
edited by Matthew Kastor, Saturday, March 05, 2011, 18:02

Gibt es eine Möglichkeit das Forum per include in die Homepage einzubauen?
Ich habe das Forum im Ordnuner /forum/ liegen und rufe die Seiten per "index.php?seite=forum" auf.

Wenn ich jetzt die index.php include, erhalte ich folgende Error-Meldungen:

"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at index.php:9) in /forum/index.php on line 29

Warning: Smarty error: unable to read resource: "german.lang" in /forum/modules/smarty/Smarty.class.php on line 1093

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 205

Warning: Cannot modify header information - headers already sent by (output started at /index.php:9) in /forum/index.php on line 207

Warning: Smarty error: unable to read resource: "default/main.tpl" in /forum/modules/smarty/Smarty.class.php on line 1093"

Gibt es da überhaupt eine Möglichkeit mit einem include? Oder könnte ich das Forum z.B. nur als iframe direkt in die Seite einbauen?

via Google Translate:

Is there a way to install the forum in your script in the home?
I Ordnuner in the forum / forum have /, and call the pages by "index.php? Page = forum" on.

If I include the index.php, I get the following error messages:

Warning: session_start () [function.session-start]: Can not send session cache limiter - headers already sent by (output started at index.php: 9) in / forum / index.php on line 29

Warning: Smarty error: unable to read resource: "german.lang" in / forum / modules / smarty / Smarty.class.php on line 1093

Warning: Can not modify header information - headers already sent (output started at / index.php: 9) in / forum / index.php on line 205

Warning: Can not modify header information - headers already sent (output started at / index.php: 9) in / forum / index.php on line 207

Warning: Smarty error: unable to read resource: "default / main.tpl" in / forum / modules / smarty / Smarty.class.php on line 1093 "

Is there any possibility to include one? Or I could be the forum for example only as iframe directly built into the side?


Including index.php will give you the error:

Warning: session_start () [function.session-start]: Can not send session cache limiter - headers already sent by (output started at index.php: 9) in / forum / index.php on line 29

because the file you are including it in has already sent headers. Your server has to send the headers before anything else. http://php.net/manual/en/function.header.php

The other header errors are also caused by this.

The smarty errors are caused by including the file located in http://yoursite.com/forum because they don't know you are running them from a different location. They are looking for "german.lang" and "default / main.tpl" relative to the location they expect to be in.

I left a message a few minutes ago that you could use an .htaccess file with rewrite rules in it if you are using an Apache server. This will work perfectly. I have another solution for you. If you are not using Apache, then you can send visitors to your forum automatically when they arrive at your website with one line of PHP code. This will work from anywhere in your site, place the file in the folder accessed when visitors first arrive.

name it index.php


<?php
header("Location: http://yoursite.com/forum/");
?>

The second special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless the 201 or a 3xx status code has already been set. -- PHP.net Manual


Do you know if there is a good add-on for Thunderbird to translate my email? That would be very good. :-D

Yes, using PHP's header function to redirect visitors

by Riba ⌂, Sunday, March 06, 2011, 18:45 (4803 days ago) @ Matthew Kastor

Matthew - the original posted actually asked if it is possible to integrate the forum in the existing CMS.

Include - Error, Headers Already Sent - not a link.

by M. Kastor (I swear I was logged in) @, Monday, March 07, 2011, 00:30 (4803 days ago) @ Riba
edited by M. Kastor (I swear I was logged in), Monday, March 07, 2011, 00:43

Integrate? As in putting a link in the site's menu to the forum? When I read:

Is there a way to install the forum in your script in the home?

I took it to mean that the question was about installing the forum at the root of a site.

So it's a template question :D "How can I make the forum look like the rest of my site" and a data usage question "How can I use the information from the forum database on my existing website" :D Yes? Those are difficult questions to answer. I looked at the template files and they're full blown programs written in smarty's template language. They work well :D but they're not so easy to sort out. For complicated things I like using the php like:


/* filenames match variables set */
include('meta.php');
include('css.php');
include('javascript.php');
include('etc.php');

/* static variables would be in a config file */
$title = 'title';

/* logic would be in an included file, but...*/
switch ($condition) {
    case 'comment':
        $class = 'comment';
        break;
    case 'title':
        $class = 'title';
        break;
    case 'other':
        $class = 'other';
        break;
    default:
        $class = 'generic';
        break;
}

/* with heredocs all the logic is already done,
 and all you insert are varibles. The templates
 are easily manipulated with common wysiwyg html
 editors. Plus, you don't have to escape anything.
 Of course the templates are called last, and are
 in a separate file.
*/

$simplePage =<<<HEREDOC
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 1st August 2004), see www.w3.org">
 $meta 
 $css 
 $title 
 $javascript
  </head>
  <body>
    <div class="$class" id="$etc">
        some content
    </div>
  </body>
</html>
HEREDOC;

echo $simplePage;

The database stuff is easier to get at. :D Someone could select data from it and display it in an existing cms, given the proper sql statements of course. ;)

RSS Feed of thread