Customising Bellabuzz

BellaBuzz is a PHP ask/answer script. It works using flat files so there is no need for a database. Download BellaBuzz here.

Setting up

After the folder has been saved to your computer, unzip/extract the files.Open prefs.php. Look for the part that is shown below:

screenshot of prefs.php

This should be pretty self explanatory – admin and password need to be changed to a suitable username and password that you will use to log in and then answer questions users have submitted.

Make sure you type in your email address, and then a random string of letters or a “second password” for the $secret value.

The options are also pretty self explanatory. If you want to be emailed when you receive a new question, type “yes” for the first option under “general settings”. You decide the number of questions you want per page.

The timestamp can also be adjusted. For variables on this, visit php.net/date. This isn’t that important. By default it will display in this format: 01st January, 2000.

The word newest means that the newest questions will be displayed first. If you want them displayed in the opposite order, change to oldest.

Be sure you do not remove any quotation marks when editing.

Uploading

When you upload to your server, you may have conflicts with other functions.php files, such as if you’re using a CMS like FanUpdate or WordPress. The safest thing to do in this case is to upload the files to a sub folder, such as ask: yoursite.com/ask.

After uploading ALL the files to this sub folder, you need to CHMOD/change the permissions of the following files to 666:

This needs to be done so that the files are writable and that the file can be edited with the questions and answers when people submit and when you answer.

Customising

To fit the script in your layout, open up questions.php. This is the file that views the questions and the form.

Where you see the following:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
	<title>BellaBuzz</title>
   <style type="text/css">
	* { font: 11px/15px Verdana, Sans-Serif; }
	.question { font-weight: bold; font-size: 12px; }
	.answer { font-style: italic; }
	.dates { display: block; text-align: right; font-size: 10px; }
   </style>
</head>
<body>

That is the part you can edit. You can remove it and, if you’re using PHP includes, you can place the header include here. If not, place your layout coding and stylesheet coding here.

Where you see </body></html>, that is where you place your footer include, or anything after your content.

The following is how the questions are displayed. They are displayed in a paragraph.

<p>
	<span class="question"><?php echo $question; ?></span><br>
	<span class="answer"><?php echo nl2br($answer); ?></span><br>
	<span class="dates">Asked: <?php echo date($timestamp, strtotime($dateask)); ?> | Answered: <?php echo date($timestamp, strtotime($dateanswer)); ?></span>
</p>
			

You can use the classes “question”, “answer” and “dates” in your CSS to style the text, for example:

.question {
			font-weight: bold;
			font-family: Courier;
			}

You can use a blockquote or simply use formatted text to surround the question and answer; it doesn’t have to be in a paragraph. Personally when I use this script, I choose not to display the date asked/answered. Just remember the following:

<?php echo $question; ?> – displays the question
<?php echo nl2br($answer); ?> – displays the answer
<?php echo date($timestamp, strtotime($dateask)); ?> – displays the date the question was asked
<?php echo date($timestamp, strtotime($dateanswer)); ?> – displays the date the question was answered

Keeping those variables, you can code the HTML how you like, and paste those variables where you want the question, answer or dates to appear.

If you want to customise the “success” page, open ask.php and find the following:

<p>Your question was successfully added :) thank you!
<a href="questions.php">return to questions?</a></p>

Simply work around that to create your success page. You can create it how you like. It might be handy to keep the link back to the questions page there, though.

Use

To ask a question, simply visit yoursite.com/ask/questions.php.

To answer a question, log in to your admin panel by visiting yoursite.com/ask/admin.php and logging in with the username and password you typed in when you set everything up.

Note

When someone asks a question and uses quotation marks, you might have to copy their question and re-write it when answering. When you are editing questions too, you might come across this problem. A backslash (\) needs to be typed before each quotation mark.