Coding Examples
This part of the website shall help you by giving you example codes to try out and to use within your own project. There is a great variety of examples. From one-liners to small/great projects.If you have a code example yourself, feel free to contact me, so I can put it into this very example site.Code examples are grouped by topics (such as posts or users).
Examples: Posts
Following code examples are associated to posts of your board.
createPost
- No example yet
generatePosthash
Example 1:
$posthash1 = $MyBBI->generatePosthash(); // Without a parameter, your userID will be used
echo $posthash1;
echo '<br />';
$posthash2 = $MyBBI->generatePosthash(15); // Generate a posthash for userID = 15
echo $posthash2;
getLatestPosts
Example 1:
// Following code shows the 5 latest post contents of all possible forums and threads
$latest_posts = $MyBBI->getLatestPosts(0, '*', 5, true);
foreach ($latest_posts as $latest_post)
{
echo $latest_post['message'].'<br />';
}
getPost
Example 1:
$options = array(
'allow_html' => 0,
'allow_mycode' => 1,
'allow_imgcode' => 0,
'allow_smilies' => 1,
'filter_badwords' => 1
);
$post = $MyBBI->getPost(1, true, $options);
print_r($post); // Output of the post array
getPosts
Example 1:
// Following code displays authors of posts beginning with "n"
$params = array(
'fields' => 'uid, username',
'order_by' => 'username',
'order_dir' => 'ASC',
'limit_start' => 0,
'limit' => 10,
'where' => 'username LIKE \'n%\''
);
$posts = $MyBBI->getPosts($params);
foreach ($posts as $post)
{
echo $post['username'].'<br />';
}
getPostsOfThread
Example 1:
// Following code returns all posts of a thread in ascending order (ordered by post date)
$posts = $MyBBI->getPostsOfThread(7, '*', array('order_by' => 'dateline', 'order_dir' => 'ASC'));
foreach ($posts as $post)
{
echo $post['subject'].'<br />';
}
getWhoPosted
- No example yet
removePost
- No example yet
updatePost
- No example yet