Jump to content

Including a php guestbook


pwired
 Share

Recommended Posts

Hi,

In the past I tried a few times to include php guestbooks in a website but without success.
The php include always goes wrong when the guestbook makes calls down it's own folder tree
and then fails to find what it needs.

For now I am using an iframe what always seems to work:
 

<div class="block-group" id="guestbook-group">
    <div class="guestbook block">
     <iframe src="http://localhost/site/guestbook/index.php" width="99%" height="850"></iframe>
    </div>
</div>

But now that I am using processwire I am trying again to use php include or require_once
like this:
 

<div class="block-group" id="guestbook-group">
    <div class="guestbook block">
    <?php    
    include('http://localhost/site/guestbook/index.php');
    ?>
    </div>
</div>

I tried document root, server root absolute path, etc, but no success so far.
Anyone have an idea to make the include for a php driven guestbook work ?

Link to comment
Share on other sites

Works for me using $config...e.g.

include($config->paths->root . 'site/guestbook/index.php');

echo $test;//this is a variable in the above index.php
// output = This is my guestbook

What is PW telling you? Of course I don't know what index.php in your case does/contains...So, it could be a little bit more involved than this simple example...

Btw, maybe you could also convert that guestbook to a PW module? Then you can use it in a more modular way...

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

Thanks for your example code Kongondo.

I find it strange but with your code my errors disappeared now. Instead processwire

can not find any template when the guestbook index.php is loaded.

But this is something I can debug with a few index.php dummy files.

Yes, turning this php guestbook into a module would be a solution too.

Link to comment
Share on other sites

Hi Kongondo, thanks for stepping in on this.
I searched a while on the net for a good guestbook and found the digioz guestbook a real quality one.
Everthing is structured very well, responsive and style is easy to customize.

Maybe you can point us to the guestbook in question to have a look at its code to help debug?

I am developing local on laptop so I have nothing online but here are the links to the guestbook,

open source gnu general public license

Link to the guestbook demo
http://www.digioz.com/demo/php/guestbook/list.php?page=1&order=asc

Link to help
http://digioz.com/downloads/php/help/guestbook/DigiOz%20Guestbook.html?

Link to github
https://github.com/digioz/php/tree/master/guestbook

Link to download
http://www.digioz.com/downloads/php/guestbook.zip

I think it could be adapting all the includes in the guestbook php code to the correct new relative path

or including the guestbook header and footer in the processwire template ?

Link to comment
Share on other sites

Dude,

It's ProcessWire, why using an external guestbook? :)

$entry = new Page();
$entry->template = 'guestbook-entry';
$entry->parent = $pages->get('/guestbook-entries/');
$entry->name = 'John Doe';
$entry->date = time();
$entry->comment = 'ProcessWire rocks';
$entry->save();

$entries = $pages->find('template=guestbook-entry,sort=-date,limit=100');
foreach ($entries as $entry) {
  echo '<h2>' . $entry->name . '</h2>';
  echo '<p>' . $entry->comment . '</p>';
}
  • Like 4
Link to comment
Share on other sites

Hi Wanze, thanks for stepping in,

This is really a nice guestbook with following features:

    SYSTEM
    Flat file data storage for ease of setup
    Header and Footer files allow you to customize it to fit your web site
    Support of an unlimited number of languages using Language file generator
    Smiley face support for guestbook entries posted
    Styling support for bold, underline, italic font and centered text
    Search feature to search through guestbook entries
    Sorting capability for sorting entries by oldest or newest entry
    Ability to make the email, name or message fields optional

    ADMIN
    Administrative area for deleting entries and monitoring the IP of spammers
    Admin email notification for messages posted (optional)

    PROTECTION:
    Image verification to prevent spam from automated bots from posting
    IP blocking for protection from spammers
    Flood protection to prevent users from posting spam posts over and over
    Referring URL Check to make sure spam bots do not auto submit messages
    Bad word filter which can be customized to filter out any bad word

To code all this together with the processwire api would take me too much time.

Link to comment
Share on other sites

Yep..Wanze beat me to it...I thought the guestbook was something more elaborate :-)


The guestbook is just like the Blog Module...minus the posts :-)...You can have each message be a comment in ProcessWire attached to one page (one page = one guestbook), or have each message be a page with one comment (group of sibling pages = one guestbook). The other stuff you see in the frontend are just cosmetic stuff you can achieve with jQuery...

The blocking stuff, etc, you can achieve all that with inbuilt comments module, or extend it to achieve what you want..

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

even the smileys could be nice to administrate with one page for one smiley image page title = ";)" page image file "smiley.png"...

and some link i've in my bookmarks on this topic:

http://tutorialzine.com/2015/01/shoutbox-php-jquery/

it uses Emoji One:

http://emojione.com/demo

May a own comments branch would be better for this as the full blown blog modul. together with commentmanger modul it would be a nice solution for such guestbook things..

regards mr-fan

  • Like 3
Link to comment
Share on other sites

  • 8 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...