Recent Topics / Sticky Question

phpBB SEO Premod for phpBB3 support forum.
This premodded version of phpBB3 includes the three different type of URL rewriting for phpBB3 by phpBB SEO. It comes with several other Search Engine Optimization mods installed.

Moderator: Moderators

Recent Topics / Sticky Question

Postby Rick_M71 » Fri Feb 05, 2010 5:00 am

I have done the NV recent topics mod which works fine, but I'm trying to figure out how to have either sticky's or announcements stay on my home page. It turns out I had some high ranking threads that dropped in the search engine rankings once they fell off the home page. I think they'd do better if I can add them back without having to continuously "bump" them, etc.

Any ideas how to get the sticky's to stay at the top of the recent topics on the home page? Any other suggestions?

Thanks!
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Advertisement

Re: Recent Topics / Sticky Question

Postby austin881 » Wed Feb 17, 2010 8:30 pm

What you are talking about is outside the scope of the NV Recent Topics mod. The mod does exactly what it implies, shows recent topics. It does not account for what type of topic it is so it will not give added weight to its duration on your index page.

I would suggest a different mod. A mod that only shows the Global Announcements or Sticky's or Announcements on your index page. Forget trying to adapt NV Recent Topics to have the functionality you want.

Ya know, many of the Portal mods available have blocks that do just what you want. Why not download the portal and find the block you want and make the necessary modifications to use it on your index page?
My dev playground: Whoa.co
Appreciate my assistance? You can thank me by linking to my Chevrolet Astro forums.
User avatar
austin881
phpBB SEO Team
phpBB SEO Team
 
Posts: 249
Joined: Wed Oct 28, 2009 12:16 am
Location: Boise, Idaho USA

Re: Recent Topics / Sticky Question

Postby Rick_M71 » Wed Feb 17, 2010 9:34 pm

A portal would work well, assuming it will work with phpbb-seo.

Is there a portal you would recommend that works well with phpbb-seo?

Or a mod to show announcements on the front page would work too.

Thanks for your reply.
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Re: Recent Topics / Sticky Question

Postby austin881 » Wed Feb 17, 2010 9:53 pm

Your options are endless. If you want to be more specific as to what you want I can point you in the right direction. You want only Global Announcements? Only Sticky's? Only regular Announcements? Announcements from a particular forum?

I would suggest you read this... http://blog.phpbb.com/2009/11/09/how-to ... nal-pages/

Use the EXAMPLE 1: Display latest topics from specified forums option and define $forum_id as the forum you want the topics to be pulled from.

-or-

There are many options but I don't spend time explaining them until you know exactly what you want.
My dev playground: Whoa.co
Appreciate my assistance? You can thank me by linking to my Chevrolet Astro forums.
User avatar
austin881
phpBB SEO Team
phpBB SEO Team
 
Posts: 249
Joined: Wed Oct 28, 2009 12:16 am
Location: Boise, Idaho USA

Re: Recent Topics / Sticky Question

Postby Rick_M71 » Wed Feb 17, 2010 10:16 pm

What I need is the 20 most recent topics on the home page with proper seo links (I have this now with NV recent topics and mods I read here).

I also want the posts (maybe 5 or so) I designate to always be on the home page - either designated as stickies, announcements, I don't really care. Stickies makes the most sense but announcements would work too.
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm

Re: Recent Topics / Sticky Question

Postby austin881 » Wed Feb 17, 2010 11:13 pm

Lets see if this is what you are looking for...

Open root/index.php
Find:
Code: Select all
// Output page

Add before:
Code: Select all
// BEGAN - Stickies
// an array of user types we dont' bother with
$ignore_users = array(USER_IGNORE, USER_INACTIVE); // could add board founder USER_FOUNDER if wanted to

// grab auths that allow a user to read a forum
$forum_array = array_unique(array_keys($auth->acl_getf('!f_read', true)));

// we have auths, change the sql query below
$sql_and = '';
if (sizeof($forum_array))
{
   $sql_and = ' AND ' . $db->sql_in_set('p.forum_id', $forum_array, true);
}

// grab all posts that meet criteria and auths
$sql_ary = array(
   'SELECT'   => 'MAX(p.post_time) as post_time, u.user_id, u.username, u.user_colour, t.topic_title, t.forum_id, t.topic_id, t.topic_type, f.forum_name',
   'FROM'      => array(TOPICS_TABLE => 't', POSTS_TABLE => 'p'),
   'LEFT_JOIN'   => array(
      array(
         'FROM'   => array(USERS_TABLE => 'u'),
         'ON'   => 'p.poster_id = u.user_id',
      ),
      array(
          'FROM' => array(FORUMS_TABLE => 'f'),
          'ON'   => 'f.forum_id = t.forum_id',
      ),
   ),
   'WHERE'      => 'p.topic_id = t.topic_id
      AND p.post_approved = 1
      AND t.topic_type = ' . POST_STICKY . '
      AND t.topic_moved_id = 0' . $sql_and,
   'GROUP_BY'   => 't.topic_id',
   'ORDER_BY'   => 'post_time DESC',
);

// Limit the results to the last 5 stickies
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), 5);

while( $row = $db->sql_fetchrow($result) )
{
   $topic_id = $row['topic_id'];
   $forum_id = $row['forum_id'];

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   $phpbb_seo->set_url($row['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
   $phpbb_seo->prepare_iurl($row, 'topic', $row['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]);
   // www.phpBB-SEO.com SEO TOOLKIT END

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN -> no dupe
   $topic_url = $phpbb_seo->seo_opt['no_dupe']['on'] ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id . '&start=' . @intval($phpbb_seo->seo_opt['topic_last_page'][$topic_id])) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $forum_id . '&t=' . $topic_id);
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN -> no dupe

   $topic_title = censor_text($row['topic_title']);

   $template->assign_block_vars('stickies',array(
      'U_TOPIC'       => $topic_url,
      'TOPIC_TITLE'    => $topic_title,
      'USERNAME_FULL'   => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
   ));
}
$db->sql_freeresult($result);
// ENDED - Stickies


Open root/styles/prosilver/template/index_body.html
Find:
Code: Select all
<!-- INCLUDE forumlist_body.html -->

Add before:
Code: Select all
<div class="forabg">
    <div class="inner"><span class="corners-top"><span></span></span>
        <table class="table1" cellspacing="1">
        <thead>
            <tr>
                <th>Stickies</th>
            </tr>
        </thead>
        <tbody>
        <!-- BEGIN stickies -->
            <tr class="<!-- IF stickies.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
                <td><a href="{stickies.U_TOPIC}">{stickies.TOPIC_TITLE}</a> by {stickies.USERNAME_FULL}</td>
            </tr>
        <!-- END stickies -->
        </tbody>
        </table>
    <span class="corners-bottom"><span></span></span></div>
</div>


I put that together rather quickly so I'm not sure if it exactly what you want and it might be more than you wanted. Basically it pulls all topics of type POST_STICKY and displays them along with the username who posted the topic on your index page sorted in a descending order from newest to oldest. It uses a few phpBB-SEO tricks to make use of Zero Duplicate and format the URL like you wanted it. It limits the query to the last 5 stickies that were posted.

Give it a try. :mrgreen:
My dev playground: Whoa.co
Appreciate my assistance? You can thank me by linking to my Chevrolet Astro forums.
User avatar
austin881
phpBB SEO Team
phpBB SEO Team
 
Posts: 249
Joined: Wed Oct 28, 2009 12:16 am
Location: Boise, Idaho USA

Re: Recent Topics / Sticky Question

Postby Rick_M71 » Thu Feb 18, 2010 2:53 am

Thank you VERY much. I'll give it a try soon and let you know if the coding works as planned.

I totally appreciate your work on this!
Rick_M71
 
Posts: 32
Joined: Mon Nov 12, 2007 4:22 pm


Return to phpBB SEO Premod

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 7 guests