Not logged in. · Lost password · Register
Forum: General Help and Support Syntax and Usage RSS
how to integrate a guest book in a dokuwiki page
Page:  1  2  next 
Avatar
ericlin #1
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Subject: how to integrate a guest book in a dokuwiki page
Hi, I'm trying to put  a guestbook in a dokuwiki page, so that everyone can leave me a message.
I download a php guestbook. I don't have problem to execut it using an external link(but this will
be in a new window, which is not what I want)
But when I tried to put it in an existing dokuwiki page using:
<php>
include("guest.php");
</php>

I got the following error:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /homepages/45/d184410608/htdocs/lib/tpl/sidebar/main.php:3) in /homepages/45/d184410608/htdocs/guest.php on line 90

Does anyone know what I should do ? Thanks.
Avatar
purplepaisley #2
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
It sounds like you need to include your php file before any page content output. Perhaps the very first line of lib/tpl/default/main.php. If it still gives you an error, I would try it as the first line of doku.php.

I'm using "My Two Cents" in a similar way for comments. Works well within Dokuwiki templates but requires mysql.
http://wiki.splitbrain.org/sw:my_two_cents?s=two%20cents

Hope that helps.
Avatar
ericlin #3
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Hi, Thanks for your reply.
I tried "My Two Cents" and got:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homepages/45/d184410608/htdocs/t2/mtc.class.php on line 95

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /homepages/45/d184410608/htdocs/t2/mtc.class.php on line 98

Do you know why I got those errors ?  Sorry I don't know much about php.

Thanks

Eric
Avatar
zyberdog #4
Member since Oct 2006 · 25 posts · Location: Denmark
Group memberships: Members
Show profile · Link to this post
Just as another option, I wanted to mention the Discussion plugin. Instead of using it for a discussion section below each page, you could set up a single wiki:guestbook page with ~~DISCUSSION~~ whilst turned off everywhere else.

As far as I can tell from your first post it would do what you are after.
Avatar
ericlin #5
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
zyberdog, Thanks for your reply. I tried the Discussion plugin. However 2 problems bother me. (1) It does not have the spam preventing feature. (2) Looks like if I install the sidebar template,  the discussion will not work. Thanks again for your reply and any other replies you may make. :)
Avatar
purplepaisley #6
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
I'm not sure why you have the mysql errors. Did you run the sql query to setup your tables for MTC?
Avatar
ericlin #7
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Purplepaisley, Thanks for your reply. What I did was (1)using panel of my hosting service to create mySQL database. (2) Modify mtc.class.php for these variables: $db_host, $db_user,$db_pass,$db_name   Is there anything else I need to do ? Thanks again.
Avatar
purplepaisley #8
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Yes, you need to run a mysql query that is contained in the db.sql file in the download package. PHPmyadmin is handy for this, it may be within your hosting control panel, in the Mysql section.
Avatar
ericlin #9
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Purplepaisley, I found PHPmyadmin but don't know how to "run a mysql query". I can see some options here: "Server Choice", "My SQL (Export)", "phpMyAdmin(Language)", "phpMyAdmin documentation","Offical phpMyAdminHomepage" Could you tell me how to do it ? Thanks again.
Avatar
ericlin #10
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Oh, I also found if I click on the db at left hand side, I got "Create new table on database db....."  Name:  _____  Number of fields: ___  Is this what I should do ? What data should I fill in ? Thanks
Avatar
purplepaisley #11
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
When you click on the database that you created on the left, you should have a tab on the right for an SQL query? Mine is "Query". On this page, there should be a box labeled "SQL query on database xxxx", just paste the contents of the db.sql into that box and click Submit query.
Avatar
ericlin #12
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
that's what I got: :(

 MySQL said:
#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' at line 1
Avatar
purplepaisley #13
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Sorry, I forgot about the first line. No need to create a database because you've already done that. Paste from the line that starts with "CREATE TABLE...."
Avatar
ericlin #14
Member since Nov 2006 · 15 posts
Group memberships: Members
Show profile · Link to this post
Purplepaisley, Again, thanks for your help. I've (I guess) successfully created table "mtc_comments' (after I removed "CHARACTER SET utf8 COLLATE utf8_general_ci". So, it looks good now. I can see a form waiting for me to input data. However, when I tried to leave a message, it doesn't seem to work. It doesn't report any error or warning, but it also did not show the messages I just typed. 
  Question: Is it right thing to write the code like this: (at the start page)


<php>
require_once('mtc.class.php');
$MTC = new MTC();
$MTC->init();

$MTC->comment_form();
$MTC->comments();
</php>

Thank you one million times !!
Avatar
purplepaisley #15
Member since May 2006 · 142 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
No problem. You're doing well considering my instructions are half wrong, I must have been tired last night, sorry.

Check to see if your comments have been added to the database in phpmyadmin. If you choose your new database, you should see a list of the tables, click the mtc one. Then there should be a browse tab on the right. When you click that, it will list the rows in your table. Are there any? If yes, what is in the "url" field of this one that is not displaying?
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Page:  1  2  next 
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2020-01-27, 19:33:09 (UTC +01:00)