The Articles Topic

All updates to the site will be posted here.

Moderator: CricketMX Forum Moderators

Re: The Articles Topic

Postby battye » Mon Oct 24, 2011 3:25 pm

Adding the censor_text() function call means if there are any swear words (or anything else in the word filter) in the message they will be censored. If you don't expect this to be a problem, it doesn't matter whether the functional call is there or not.

To have the link displayed properly, replace:

Code: Select all
echo $topic_link;


With:

Code: Select all
echo '<a href="' . $topic_link . '">Read more</a>';


Similarly for the other items, you can add the HTML tags.

ie. to make the topic title bold (ie. <b>) and add a new line below it (ie. <br /> - you add a <br /> for each line you want to appear. So if you wanted 2 blank lines between the topic title and whatever comes next, you would put 3 <br />'s in total):

Code: Select all
echo '<b>' . $topic_title . '</b><br />';


And so on :)
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: The Articles Topic

Postby frantic purple » Mon Oct 24, 2011 7:06 pm

Okay I got everything to work. But how do I get CSS to work in "theupdater" script, not just HTML tags. Here's the script so far:
Code: Select all
<?php
/*
* home.php
* Description: example file for displaying latest posts and topics
* by battye (for phpBB.com MOD Team)
* September 29, 2009
*/

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');



/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;   

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }   

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}



$search_limit = 5;

    $forum_id = array(1, 4);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');



$posts_ary = array(
        'SELECT'    => 'p.*, t.*',
   
        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),
   
        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),
   
        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND t.topic_status <> ' . ITEM_MOVED . '
                        AND t.topic_approved = 1',
   
        'ORDER_BY'  => 'p.post_id DESC',
    );
   
    $posts = $db->sql_build_query('SELECT', $posts_ary);

   $posts_result = $db->sql_query_limit($posts, $search_limit);

      while( $posts_row = $db->sql_fetchrow($posts_result) )
      {
         $topic_title       = $posts_row['topic_title'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
         $topic_date       = $user->format_date($posts_row['topic_time']);
         $topic_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&amp;t=' . $posts_row['topic_id']);

         $post_text = nl2br($posts_row['post_text']);

         $bbcode = new bbcode(base64_encode($bbcode_bitfield));         
         $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);

         $post_text = smiley_text($post_text);


    echo '<h1>' . $topic_title . '</h1>';
    echo $topic_date . '<br />Written by ';
    echo $topic_author . '<br /><br />';
    echo $post_text;
    echo '<a href="' . $topic_link . '">Read more</a>';
}

Also what do I need to do to add a "comment link", also stating how many comments there are so far regarding that post. Do I need to add a line here:
Code: Select all
         $topic_title       = $posts_row['topic_title'];
         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
         $topic_date       = $user->format_date($posts_row['topic_time']);
         $topic_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&amp;t=' . $posts_row['topic_id']);

         $post_text = nl2br($posts_row['post_text']);

         $bbcode = new bbcode(base64_encode($bbcode_bitfield));         
         $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);

         $post_text = smiley_text($post_text);

If so where do I find this information so I can add other things in the future? Thank you so much.
frantic purple
Greenhorn
Greenhorn
 
Posts: 10
Joined: Mon Oct 10, 2011 7:06 pm

Re: The Articles Topic

Postby battye » Tue Oct 25, 2011 4:10 am

Topic information can be found in the phpbb_topics table. With the SQL know-how you are not just limited to the topics table (view http://www.phpbbdoctor.com/doc_columns.php?id=21 for a list of the different things you can add) but for simple information it should be sufficient. For the number of comments;

Find

Code: Select all
$topic_title       = $posts_row['topic_title'];


After add

Code: Select all
$topic_replies       = $posts_row['topic_replies'];


Find

Code: Select all
echo '<a href="' . $topic_link . '">Read more</a>';


Replace with

Code: Select all
echo '<a href="' . $topic_link . '">Comment link (' . $topic_replies . ')</a>';


As for your CSS, you are best putting that in your website index code, by putting it between <style type="text/css"> and </style> tags within the <head> part of the code.

Code: Select all
<?php include("site/template/config.php"); ?>

<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<head>

<style type="text/css">CSS CODE NEEDS TO GO HERE</style>

<title>MeanVent Studios | Home</title>

<meta name="description" content="Changing the rules of video game development. And being mean while doing it." />

</head>

<body>

<?php include("site/template/theupdater.php"); ?>

<b>Hello</b>

<?php include("site/template/footer.php"); ?>

<i>Testing Testing One Two...is this thing on?</i>

</body>
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: The Articles Topic

Postby frantic purple » Sun Oct 30, 2011 6:28 am

Thank you so much! Everything works great! However I now have another small thing I cannot figure out. I created a CSS file for "theupdater" script. But when I check my website to see if it worked, everything works except for the background-color. Therefore I must have linked the CSS file right, right? So why will all the CSS code work except for the background-color? Thanks.

Here's the CSS file:
Code: Select all
<style type="text/css">
body
{
background-color:#000000;
}
h1
{
font-family:"Courier New";
font-size:20px;
font-weight:bold;
font-style:normal;
color:purple;
}
p
{
font-family:"Arial";
font-size:14px;
font-weight:normal;
font-style:italic;
color:green;
}
</style>
frantic purple
Greenhorn
Greenhorn
 
Posts: 10
Joined: Mon Oct 10, 2011 7:06 pm

Re: The Articles Topic

Postby battye » Sun Nov 06, 2011 3:59 pm

I'm sorry, I'm not much of a guru with CSS. My best guess is that something might be overriding it so maybe check to make sure background-color isn't being used somewhere else?
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Seeing Her Majesty The Queen in Perth at CHOGM 2011

Postby Articles Bot » Sun Nov 06, 2011 4:01 pm

Queen Elizabeth II visted Australia for the 16th time as the English monarch during the Commonwealth Heads of Government Meeting between 28 and 30 October 2011. CHOGM was staged in Perth, Western Australia and the event marked the Queen's 8th visit to the state.

The Queen had several engagements in...


Read more
View all articles at http://www.cricketmx.com/articles/
I'm only a forum bot!
Articles Bot
Forum Bot
Forum Bot
 
Posts: 94
Joined: Thu Jan 10, 2008 8:05 am

Re: The Articles Topic

Postby frantic purple » Thu Nov 17, 2011 2:34 am

Everything was working perfectly until this happened. When the main website address (http://meanvent.com/) is typed in the URL bar, it automatically forwards to a weird error page in the forum (http://meanvent.com/forum). However when the script is deleted from the index page the site shows everything like it should. There's also another thing that happens where the forum shows the message: This board has no forums. However the forums show up when I log in as an Admin, but I checked to make sure the forums can be viewed by everyone. The same thing happens when I go to the main site (http://meanvent.com/) and am also logged into the forum (http://meanvent.com/forum). The script works perfectly and the error doesn't show (although the message: This board has no forums still shows up at the forum).

Script:
Code: Select all
<?php
/*
* home.php
* Description: example file for displaying latest posts and topics
* by battye (for phpBB.com MOD Team)
* September 29, 2009
*/

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');



/* create_where_clauses( int[] gen_id, String type )
* This function outputs an SQL WHERE statement for use when grabbing
* posts and topics */

function create_where_clauses($gen_id, $type)
{
global $db, $auth;

    $size_gen_id = sizeof($gen_id);

        switch($type)
        {
            case 'forum':
                $type = 'forum_id';
                break;
            case 'topic':
                $type = 'topic_id';
                break;
            default:
                trigger_error('No type defined');
        }

    // Set $out_where to nothing, this will be used of the gen_id
    // size is empty, in other words "grab from anywhere" with
    // no restrictions
    $out_where = '';

    if( $size_gen_id > 0 )
    {
    // Get a list of all forums the user has permissions to read
    $auth_f_read = array_keys($auth->acl_getf('f_read', true));

        if( $type == 'topic_id' )
        {
            $sql     = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
                        WHERE ' .  $db->sql_in_set('topic_id', $gen_id) . '
                        AND ' .  $db->sql_in_set('forum_id', $auth_f_read);

            $result     = $db->sql_query($sql);

                while( $row = $db->sql_fetchrow($result) )
                {
                        // Create an array with all acceptable topic ids
                        $topic_id_list[] = $row['topic_id'];
                }

            unset($gen_id);

            $gen_id = $topic_id_list;
            $size_gen_id = sizeof($gen_id);
        }

    $j = 0;

        for( $i = 0; $i < $size_gen_id; $i++ )
        {
        $id_check = (int) $gen_id[$i];

            // If the type is topic, all checks have been made and the query can start to be built
            if( $type == 'topic_id' )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

            // If the type is forum, do the check to make sure the user has read permissions
            else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
            {
                $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
            }

        $j++;
        }
    }

    if( $out_where == '' && $size_gen_id > 0 )
    {
        trigger_error('A list of topics/forums has not been created');
    }

    return $out_where;
}



$search_limit = 5;

    $forum_id = array(1, 4);
    $forum_id_where = create_where_clauses($forum_id, 'forum');

    $topic_id = array();
    $topic_id_where = create_where_clauses($topic_id, 'topic');



$posts_ary = array(
        'SELECT'    => 'p.*, t.*',

        'FROM'      => array(
            POSTS_TABLE     => 'p',
        ),

        'LEFT_JOIN' => array(
            array(
                'FROM'  => array(TOPICS_TABLE => 't'),
                'ON'    => 't.topic_first_post_id = p.post_id'
            )
        ),

        'WHERE'     => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
                        AND t.topic_status <> ' . ITEM_MOVED . '
                        AND t.topic_approved = 1',

        'ORDER_BY'  => 'p.post_id DESC',
    );

    $posts = $db->sql_build_query('SELECT', $posts_ary);

   $posts_result = $db->sql_query_limit($posts, $search_limit);

      while( $posts_row = $db->sql_fetchrow($posts_result) )
      {
         $topic_title       = $posts_row['topic_title'];
         $topic_replies       = $posts_row['topic_replies'];

         $topic_author       = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
         $topic_date       = $user->format_date($posts_row['topic_time']);
         $topic_link       = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&amp;t=' . $posts_row['topic_id']);

         $post_text = nl2br($posts_row['post_text']);

         $bbcode = new bbcode(base64_encode($bbcode_bitfield));
         $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);

         $post_text = smiley_text($post_text);


    echo '<h1>' . $topic_title . '</h1>';
    echo $post_text . '<br /><br />';
    echo 'Written by ' . $topic_author . ' - ';
    echo $topic_date . ' - ';
    echo '<a href="' . $topic_link . '">Comments (' . $topic_replies . ')</a>' . '<br /><hr>';
}

So I'm just wondering why exactly this is happening? Was my website hacked? Or did the web host (http://bluehost.com/) have something to do with it? Thanks I'm pretty lost on this one. It was working perfectly one day then a week or so later it just didn't work, even though I haven't edited any of my website when this happened.
frantic purple
Greenhorn
Greenhorn
 
Posts: 10
Joined: Mon Oct 10, 2011 7:06 pm

Re: The Articles Topic

Postby battye » Sun Nov 20, 2011 4:12 pm

frantic purple, I just wanted to let you know I've read your post but I don't have enough time right now to write a detailed reply. The fact that it was working and then suddenly it stopped working is very strange. What was the filename of the script? index.php or home.php?

Is the forum supposed to be at http://meanvent.com/forum?
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Re: The Articles Topic

Postby frantic purple » Sun Nov 20, 2011 8:47 pm

Script file name: theupdater.php
(http://meanvent.com/site/template/theupdater.php)

Yes the forum is at http://meanvent.com/forum. Thank you so much for helping out, it was the weirdest thing. Also take your time, your the one helping me, remember? :) I'm thankful you've answered all of my annoying questions this far.
frantic purple
Greenhorn
Greenhorn
 
Posts: 10
Joined: Mon Oct 10, 2011 7:06 pm

Re: The Articles Topic

Postby battye » Mon Nov 28, 2011 2:51 pm

In your FTP, do you see an index.php file inside the main directory (ie. the directory above forum/)?
Do you see a .htaccess file?

Don't post either of those files publicly, but please PM me the contents. I guess there is some redirection happening but I'm not sure why.
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14249
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

The Killers hit another home run with The Cowboys Christmas Ball

Postby Articles Bot » Sat Dec 24, 2011 4:09 pm

The Killers new EP, (RED) Christmas EP, is one of the diverse Christmas compilations going around featuring the classic pop-rock sound fans of The Killers will be familiar with as well an upbeat country track, a Mexican style mariachi offering and more relaxed ballad. This has been a long time comin...


Read more
View all articles at http://www.cricketmx.com/articles/
I'm only a forum bot!
Articles Bot
Forum Bot
Forum Bot
 
Posts: 94
Joined: Thu Jan 10, 2008 8:05 am

Coca Cola Bottle Bat in the Australian summer of cricket

Postby Articles Bot » Wed Dec 28, 2011 7:23 am

The Coca Cola BottleBat is this summers cricket promotion. It is tough for companies to keep ideas fresh and it is even harder to top the promotions of years gone by - the talking Boonie figurines offered by VB with a carton of beer several years ago were immensely popular.

The Coca Cola BottleBat ...


Read more
View all articles at http://www.cricketmx.com/articles/
I'm only a forum bot!
Articles Bot
Forum Bot
Forum Bot
 
Posts: 94
Joined: Thu Jan 10, 2008 8:05 am

Using XSD to assist in XML deserialisation to objects in C Sharp

Postby Articles Bot » Sun Apr 22, 2012 10:10 am

In the past when I have performed deserialisation (taking the hierarchical contents of an XML file and converting that that to an object hierarchy at run time) I have used methods such as XmlDocument and manually created objects, or created my own classes and implemented a more traditional style of ...


Read more
View all articles at http://www.cricketmx.com/articles/
I'm only a forum bot!
Articles Bot
Forum Bot
Forum Bot
 
Posts: 94
Joined: Thu Jan 10, 2008 8:05 am

Re: Cheesy fries and the Bandito Pockett define fast food in

Postby Johny » Tue Sep 30, 2014 2:49 am

Articles Bot wrote:
Population wise Australia is quite small, such that even the largest city - Sydney (4.5 million) - it has fewer people than Singapore (4.9 million) despite the advantage of land and room for expansion. Australia is a fantastic country in many ways, but in my opinion decentralised urban centres with ...


Read more
Digg this article


Hi guys! I am new here. I just want to ask if anyone here knows about Mandai Foodlink http://www.foodlinkmandai.com/. I accidentally visited their site while I am doing my research about Singapore's delicacies and food. Though, I read some review about it I am still not sure what mandai foodlink is. Is this a resto or a food centre?
Johny
Greenhorn
Greenhorn
 
Posts: 5
Joined: Tue Sep 30, 2014 2:45 am

Re: The Articles Topic

Postby Layzie Bone » Sun Oct 19, 2014 3:55 pm

So what kind of research are you doing? Are you a web designer. Your posts there sort of indicate that in the other forums.

Food Link Mandai seems to be some sort of food court/development complex, can't say for sure though....Not sure why you're quoting the Articles bot on a two year old post, I really hope you're a real person :)
User avatar
Layzie Bone
Mr. Computergeek Salad Guy
Mr. Computergeek Salad Guy
 
Posts: 2424
Joined: Mon May 24, 2004 11:59 pm
Location: North Carolina

PreviousNext

Return to Updates

Who is online

Users browsing this forum: No registered users and 1 guest

cron