phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
X last post and simple rewrite mod
Goto page 1, 2  Next
 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
::  
Author Message
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sat Jun 03, 2006 11:00 am    Post subject: X last post and simple rewrite mod

Hi

i have another little request
I have installed simple rewrite mod, google sitemap and sitemap module on
a big persian forum in this address

http://www.siscenter.com/forum/

my friend was using a little script for showing X last post
in top of his forum (scrolling X last post) but at this time he
can't use this script because this script only can make URLs with
php prefix. can you change it to work with simple rewrite mod ?

its the code of that script

Code:
<?php
// Basic Configuration
// How Many Topics you want to display?
$topicnumber = 30;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB path
$urlPath = "http://www.siscenter.com/forum";
// Database Configuration (Where your phpBB config.php file is located
include 'config.php';
// Connecting & Selecting Databases
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
// Perform Sql Query
$query = "SELECT t.topic_poster,t.topic_views,t.topic_replies,t.topic_id, t.topic_title, t.topic_last_post_id,
             t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username ,f.forum_name
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.topic_status <> 2 AND
t.forum_id <> 30 AND
t.forum_id <> 50 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
// Outcome of the HTML
// Be carefull when you edit these!
print "<marquee dir=\"rtl\" align=\"center\" id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"150\" width=\"100%\"  scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"stop()\" onMouseOut=\"start()\">";
print "<div align=\"center\">";
print "<table cellpadding='3' cellSpacing='2'";

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$forum_no = $row["forum_id"];
if  (($forum_no <> 34) and ($forum_no <> 39 ) and ($forum_no <> 41 ))
{
echo
   "<tr valign='top'>
       <td><font face=\"Tahoma\" size=\"1\"><font color=\"#FFCC00\"><b> </b><font color=\"#978981\">  ãæÖæÚ :
        <a href=\"$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]\">
        <span style=\"text-decoration: none\">" . $row["topic_title"] .

        "</span></a></td></font></b><td><font face=\"Tahoma\" size=\"1\"><font color=\"#978981\">  ÇäÌãä :
        <font color=\"#978981\">
        <$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["forum_name"] .
        "</td><td><font face=\"Tahoma\" size=\"1\"><font color=\"#C0C0C0\">" .

        "</span></a></td></font></b><td><font face=\"Tahoma\" size=\"1\"><font color=\"#978981\">  ÈÇÒÏíÏåÇ :
        <font color=\"#978981\">
        <$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["topic_views"] .
        "</td><td><font face=\"Tahoma\" size=\"1\"><font color=\"#C0C0C0\">" .

       "</span></a></td></font></b><td><font face=\"Tahoma\" size=\"1\"><font color=\"#978981\">  ÇÓÎ åÇ  :
        <font color=\"#978981\">
        <$urlPath/viewtopic.php?p=$row[topic_last_post_id]#$row[topic_last_post_id]>" . $row["topic_replies"] .
        "</td><td><font face=\"Tahoma\" size=\"1\"><font color=\"#C0C0C0\">" .

        "</span></a></td></font></b><td><font face=\"Tahoma\" size=\"1\"><font color=\"#978981\"> ÂÎÑíä ÇÑÓÇá :
        <a href=\"$urlPath/profile.php?mode=viewprofile&u=$row[user_id]\">" . $row["username"] .
        "</td><td><font face=\"Tahoma\" size=\"1\"><font color=\"#C0C0C0\">" .

        "</td></tr></font>";


   }}
print "</table></div></marquee>";
// Free Result
mysql_free_result($result);
// Close the Connection
mysql_close($link);
?>


thanks Smile

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sat Jun 03, 2006 5:32 pm    Post subject: Re: X last post and simple rewrite mod

All right, you are lucky, I had 5 min to sort this out.

So first, this code is outrageous Very Happy Is it actually working as is ?

Just jocking Wink

So I basically kept the principle, but included this page in phpBB sessions.

This mean you have access to the phpBB functions and languages files Wink

But this is OK if the page where this is outputted is not part of phpBB, is so you will have to comment a bit of code.

And, since post URL are not the one we want to Search Engine optimize, they are duplicates of the holly topic URL Wink , I also mad up a version outputting the last active topic links instead Wink

I implemented the auth check so that everybody sees what he has the right to.
The script is simple and works well Wink

Please note that
Code:
dir=\"rtl\"
is here for persian, get rid of it if you want the output to be aligned to the left instead.

Css :

I implemented css classes in the html code, using the class="nav" subSilver's css class.
This means you have to either add the path to the css or add the css definition in your page, you can off course change the class with whatever and define it as you wish.


Here it goes :

Make sure you set up correctly the Basic Configuration constants.


Last XX Active Topics outside phpBB :

Code:
<?php
// Last XX Active Topics outside phpBB - dcz - www.phpBB-SEO.com
// License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
//
// Basic Configuration
// How Many Topics you want to display?
$topicnumber = 30;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB URL
$urlPath = "http://www.example.com/phpBB";
// Change this to your phpBB path
$phpbb_root_path = 'phpBB/';
// Exclude forums, forum id in this array will not be listed
$exclude_forum = array (
   //1 => 31,
   //2 => 5,
   //3 => 10,
);

define('IN_PHPBB', true);

include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management



// Let's do it now ;-)
$sql = "SELECT t.topic_poster,t.topic_views,t.topic_replies,t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username ,f.forum_name
   FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
   WHERE t.topic_id = p.topic_id
      AND f.forum_id = t.forum_id
      AND t.topic_status <> 2
             AND p.post_id = t.topic_last_post_id
      AND p.poster_id = u.user_id
   ORDER BY p.post_id DESC LIMIT $topicnumber";
//Begin sql cache
if ( !($result = $db->sql_query($sql)) )
//if ( !($result = $db->sql_query($sql, false, 'posts_')) )
//End sql cache
{
   message_die(GENERAL_ERROR, 'Could not obtain Last topics info', '', __LINE__, __FILE__, $sql);
}
$last_topic_data = array();
while( $row = $db->sql_fetchrow($result) )
{
   $last_topic_data[] = $row;
}
$db->sql_freeresult($result);
unset($row);

// Handle the not topics case, if you want :-)
if ( !($total_topics = count($last_topic_data)) )
{
   $message = 'Something you want to say here ;-)';
   message_die(GENERAL_MESSAGE, $message);
}

//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $last_topic_data);

// here I keep the basic html output
// Outcome of the HTML
// Be carefull when you edit these!
echo "<marquee dir=\"rtl\" align=\"center\" id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"150\" width=\"100%\"  scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"stop()\" onMouseOut=\"start()\">";
echo "<div align=\"center\">";
echo "<table cellpadding='3' cellSpacing='2'";

for ($i = 0; $i < $total_topics; $i++ )
{
   if ($is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))
   {
      // phpBB-SEO.com SEO TOOLKIT BEGIN
      $seo_forum_name = $last_topic_data[$i]['forum_name'];
      $seo_topic_name = $last_topic_data[$i]['topic_title'];
      // phpBB-SEO.com SEO TOOLKIT END

      echo "<tr valign='top'>
             <td><span class=\"nav\">".$lang['Last_Post']." :
           <a href=\"".append_sid("$urlPath/viewtopic.php?t=".$last_topic_data[$i]['topic_id'])."\" class=\"nav\">" . $last_topic_data[$i]['topic_title'] ."</span></a></td>
      <td><span class=\"nav\"> ".$lang['Forum']." :
      <a href=\"".append_sid("$urlPath/viewforum.php?f=".$last_topic_data[$i]['forum_id'])."\" class=\"nav\">" . $last_topic_data[$i]["forum_name"] . "</a></span></td>
      <td><span class=\"nav\"> ".$lang['Views']." : " . $row['topic_views'] . "</span></td>
      <td><span class=\"nav\"> ".$lang['Replies']."  : " . $last_topic_data[$i]['topic_replies'] . "</span></a></td>
      <td><span class=\"nav\"> ".$lang['Poster']." :
           <a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_topic_data[$i]['user_id'])."\" class=\"nav\" >" . $last_topic_data[$i]['username'] . "</a></td></tr>";

   }
}
echo "</table></div></marquee>";

?>


Which will work as is with the phpBB SEO simple mod Rewrite.

For the phpBB SEO mixed mod Rewrite, please do the following :

Find :

Code:
   if ($is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))
   {


After add :
Code:

      // phpBB-SEO.com SEO TOOLKIT BEGIN
      $seo_forum_name = $last_topic_data[$i]['forum_name'];
      // phpBB-SEO.com SEO TOOLKIT END


For the phpBB SEO Advanced mod Rewrite add this instead in the same place :

Code:
      // phpBB-SEO.com SEO TOOLKIT BEGIN
      $seo_forum_name = $last_topic_data[$i]['forum_name'];
      $seo_topic_name = $last_topic_data[$i]['topic_title'];
      // phpBB-SEO.com SEO TOOLKIT END


Then, if you call this code within a phpBB page or a page already using phpBB sessions, get rid of this part :

Note :
It would be better then to use the phpBB template system instead of echo.

Code:
define('IN_PHPBB', true);

include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management



This will even log-in users with auto log-in checked.

People viewing this code will be listed in the viewonline as viewing Index.

Have a look to this Blanck Template mod if you want some hints on how to add page to phpBB and thus to eventually fix the viewonline matter. But it no big dealt as is, and working the same with less code.

Then, if you still want to output post links even though they are duplicates :

Find :

Code:
          <a href=\"".append_sid("$urlPath/viewtopic.php?t=".$last_topic_data[$i]['topic_id'])."\" class=\"nav\">" . $last_topic_data[$i]['topic_title'] ."</span></a></td>


Replace Wtih :


Code:
           <a href=\"".append_sid("$urlPath/viewtopic.php?p=".$last_topic_data[$i]['topic_last_post_id'])."#".$last_topic_data[$i]['topic_last_post_id']."\" class=\"nav\">" . $last_topic_data[$i]['topic_title'] ."</span></a></td>


And now the cookie Wink

Look at this part of code if you are using the phpbbstyles.com sql cache :
Code:

//Begin sql cache
if ( !($result = $db->sql_query($sql)) )
//if ( !($result = $db->sql_query($sql, false, 'posts_')) )
//End sql cache


Ready to go Very Happy

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche


Last edited by dcz on Wed Jul 26, 2006 12:09 pm; edited 6 times in total
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 04, 2006 7:35 am    Post subject: Re: X last post and simple rewrite mod

thank you DCZ

i tested it
unfortunately it doesn't work for me and my friend

see this adress

http://forum.amuzesh.org/scroll.php

an its my configuration for the phpbb path

Code:
// Change this to your phpBB URL
$urlPath = "http://www.amuzesh.org/forum/";
// Change this to your phpBB path
$phpbb_root_path = '/';


and in my friend forum at this address

http://www.siscenter.com/forum/scroll.php

and the old one that works but output URLs are with php prefix

http://www.siscenter.com/forum/scroll1.php

Wink

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sun Jun 04, 2006 10:26 am    Post subject: Re: X last post and simple rewrite mod

amir abbas wrote:


and the old one that works but output URLs are with php prefix



Well, it always outputs the same post url.


Anyway, fixed, a line break was breaking a $last_topic_data

Please overwrite everything after
Code:
define('IN_PHPBB', true);
and it should be ok. I updated the post where I gave the code Wink

I tested it again, it is working, keep faith Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 04, 2006 11:46 am    Post subject: Re: X last post and simple rewrite mod

Quote:
I tested it again, it is working, keep faith Wink


when you say it works im sure that it works
but i think my configuration is not correct

i've recieved this erroe message

Code:
Parse error: syntax error, unexpected T_STRING in /home/persianm/public_html/forum/scroll.php on line 94


an its the line 94:

Code:
 <a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_t opic_data[$i]['user_id'])."\" class=\"nav\" >" . $last_topic_data[$i]['username'] . "</a></td></tr>";


an its my configuration in top of the file

Code:
// Change this to your phpBB URL
$urlPath = "http://www.amuzesh.org/forum";
// Change this to your phpBB path
$phpbb_root_path = 'forum/';


i also tried this one

Code:
// Change this to your phpBB URL
$urlPath = "http://www.amuzesh.org/forum";
// Change this to your phpBB path
$phpbb_root_path = '/';


and this one

Code:
// Change this to your phpBB URL
$urlPath = "http://www.amuzesh.org/forum/";
// Change this to your phpBB path
$phpbb_root_path = '/';

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sun Jun 04, 2006 12:42 pm    Post subject: Re: X last post and simple rewrite mod

amir abbas wrote:

i've recieved this error message

Code:
Parse error: syntax error, unexpected T_STRING in /home/persianm/public_html/forum/scroll.php on line 94


an its the line 94:

Code:
 <a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_t opic_data[$i]['user_id'])."\" class=\"nav\" >" . $last_topic_data[$i]['username'] . "</a></td></tr>";




I know, I edited the post with the new code but for some reason I cannot have the correct code outputted lol.
This is the line causing trouble :

Code:
 <a href=\"".append_sid("$urlPath/profile.php?mode=viewprofile&u=".$last_t opic_data[$i]['user_id'])."\" class=\"nav\" >" . $last_topic_data[$i]['username'] . "</a></td></tr>";


Noticed the
Code:
$last_t opic_data[$i]['user_id']


should be :

Code:
$last_topic_data[$i]['user_id']


that's all Wink

By the way, it is weird phpBB parsing method was tricked by this one, maybe this comes from the text wrapper I added.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 04, 2006 1:22 pm    Post subject: Re: X last post and simple rewrite mod

Code:
maybe this comes from the text wrapper I added


i had this mod
i removed that mod yesterday for a problem like this

thank you but Embarassed Embarassed

Code:
Warning: main(/extension.inc): failed to open stream: No such file or directory in /home/persianm/public_html/forum/scroll.php on line 23

Warning: main(/extension.inc): failed to open stream: No such file or directory in /home/persianm/public_html/forum/scroll.php on line 23

Warning: main(): Failed opening '/extension.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/persianm/public_html/forum/scroll.php on line 23

Warning: main(/common.): failed to open stream: No such file or directory in /home/persianm/public_html/forum/scroll.php on line 24

Warning: main(/common.): failed to open stream: No such file or directory in /home/persianm/public_html/forum/scroll.php on line 24

Warning: main(): Failed opening '/common.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/persianm/public_html/forum/scroll.php on line 24

Fatal error: Call to undefined function: session_pagestart() in /home/persianm/public_html/forum/scroll.php on line 27



first i want to know that the path is correct or not

Code:
// Change this to your phpBB URL
$urlPath = "http://forum.amuzesh.org/";
// Change this to your phpBB path
$phpbb_root_path = '/';


http://forum.amuzesh.org/scroll.php

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sun Jun 04, 2006 2:07 pm    Post subject: Re: X last post and simple rewrite mod

amir abbas wrote:


first i want to know that the path is correct or not

Code:
// Change this to your phpBB URL
$urlPath = "http://forum.amuzesh.org/";
// Change this to your phpBB path
$phpbb_root_path = '/';


http://forum.amuzesh.org/scroll.php


Ok I see :

Quote:
$phpbb_root_path = './';


If it's not working, then, try :

Quote:
$phpbb_root_path = '';


i just re tried the posted code, nothing more than the
Code:
$last_t opic_data[$i]['user_id']
issue Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 04, 2006 2:13 pm    Post subject: Re: X last post and simple rewrite mod

OK thanks

for the last request

it works now but the page suffix is php

http://forum.amuzesh.org/scroll.php

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sun Jun 04, 2006 2:20 pm    Post subject: Re: X last post and simple rewrite mod

amir abbas wrote:
OK thanks

for the last request

it works know but the page suffix is php

http://forum.amuzesh.org/scroll.php


I though you wanted to use this code though includes in non phpBB page, so that's why it's not rewritten.

If you wish to use this code standalone, maybe you should then built up a full page using the blank template mod and reusing this code in it (you'd have to output the code using the phpBB template system though).

And the suffix is not important here, Search Engine do not really car about it as long as there is no vars in the URL, which here is not the case.

This code could be used on your main domain, with an include and proper CSS, which I forgot to mention.

I implemented css classes in the html code, using the class="nav" subSilver's css class.
This means you have to either add the path to the css or add the css definition in your page, you can off course change the class with whatever and define it as you wish.
++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 11, 2006 6:44 am    Post subject: Re: X last post and simple rewrite mod

hello

Code:
I though you wanted to use this code though includes in non phpBB page, so that's why it's not rewritten.


i want to include this file in index.php file

Code:
If you wish to use this code standalone, maybe you should then built up a full page using the blank template mod and reusing this code in it (you'd have to output the code using the phpBB template system though).


i don't want to use it like a standalone page. i want to include this file in index.php

Quote:
And the suffix is not important here, Search Engine do not really car about it as long as there is no vars in the URL, which here is not the case.


excuse me i couldn't uderstand this part. you mean that i was possible to use my old script without any concern Rolling Eyes i get confused

at last
the URLs is like this one

http://forum.amuzesh.org//viewtopic.php?t=

it dosn't have nombers. i doesn't work
excuse me Embarassed can you see this url again http://forum.amuzesh.org/scroll.php

i think its possible that there is another separation between code character

and i just want to show X last post in my forum index page. just it
in scrolling shape or immovable shape
just it.

thank you for your expert guides

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Sun Jun 11, 2006 6:49 pm    Post subject: Re: X last post and simple rewrite mod

Erf, another one :
Code:
$last_topic_data[$i][' topic_id']


Should be :

Code:
$last_topic_data[$i]['topic_id']



I'll soon provide a zip for this.

To include in index, you need to use the phpBB Template system.

Maybe if I have some time Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Sun Jun 11, 2006 7:02 pm    Post subject: Re: X last post and simple rewrite mod

thanks a lot ِDCZ Very Happy

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
AmirAbbas
phpBB SEO Team
phpBB SEO Team


Joined: 11 May 2006
Posts: 529
Location: IRAN

X last post and simple rewrite modPosted: Fri Jun 16, 2006 4:18 pm    Post subject: Re: X last post and simple rewrite mod

i changed your code and i remove link of user profile and link of forum
now that parts are in plain text form

i changed code to this form

Code:
<?php
// Last XX Active Topics outside phpBB - dcz - www.phpBB-SEO.com
// License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
//
// Basic Configuration
// How Many Topics you want to display?
$topicnumber = 30;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB URL
$urlPath = "http://forum.amuzesh.org";
// Change this to your phpBB path
$phpbb_root_path = './';
// Exclude forums, forum id in this array will not be listed
$exclude_forum = array (
   //1 => 31,
   //2 => 5,
   //3 => 10,
);

define('IN_PHPBB', true);

include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management



// Let's do it now ;-)
$sql = "SELECT t.topic_poster,t.topic_views,t.topic_replies,t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username ,f.forum_name
   FROM ".TOPICS_TABLE." t, ".FORUMS_TABLE." f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
   WHERE t.topic_id = p.topic_id
      AND f.forum_id = t.forum_id
      AND t.topic_status <> 2
             AND p.post_id = t.topic_last_post_id
      AND p.poster_id = u.user_id
   ORDER BY p.post_id DESC LIMIT $topicnumber";
//Begin sql cache
if ( !($result = $db->sql_query($sql)) )
//if ( !($result = $db->sql_query($sql, false, 'posts_')) )
//End sql cache
{
   message_die(GENERAL_ERROR, 'Could not obtain Last topics info', '', __LINE__, __FILE__, $sql);
}
$last_topic_data = array();
while( $row = $db->sql_fetchrow($result) )
{
   $last_topic_data[] = $row;
}
$db->sql_freeresult($result);
unset($row);

// Handle the not topics case, if you want :-)
if ( !($total_topics = count($last_topic_data)) )
{
   $message = 'Something you want to say here ;-)';
   message_die(GENERAL_MESSAGE, $message);
}

//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $last_topic_data);

// here I keep the basic html output
// Outcome of the HTML
// Be carefull when you edit these!
echo "<marquee dir=\"rtl\" align=\"center\" id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"150\" width=\"100%\"  scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"stop()\" onMouseOut=\"start()\">";
echo "<div align=\"center\">";
echo "<table cellpadding='3' cellSpacing='2'";

for ($i = 0; $i < $total_topics; $i++ )
{
   if ($is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))
   {
      // phpBB-SEO.com SEO TOOLKIT BEGIN
      $seo_forum_name = $last_topic_data[$i]['forum_name'];
      $seo_topic_name = $last_topic_data[$i]['topic_title'];
      // phpBB-SEO.com SEO TOOLKIT END

      echo "<tr valign='top'>
             <td><span class=\"nav\">".$lang['Last_Post']." :
           <a href=\"".append_sid("$urlPath/viewtopic.php?t=".$last_topic_data[$i]['topic_id'])."\" class=\"nav\">" . $last_topic_data[$i]['topic_title'] ."</span></a></td>
      <td><span class=\"nav\"> ".$lang['Forum']." : " . $last_topic_data[$i]["forum_name"] . "</span></td>
      <td><span class=\"nav\"> ".$lang['Views']." : " . $row['topic_views'] . "</span></td>
      <td><span class=\"nav\"> ".$lang['Replies']."  : " . $last_topic_data[$i]['topic_replies'] . "</span></td>
      <td><span class=\"nav\"> ".$lang['Poster']." : " . $last_topic_data[$i]['username'] . "</td></tr>";

   }
}
echo "</table></div></marquee>";

?>


it works perfectly
but there is little problem

we have some private forums
unfortunatly the link of private forums' topic will appear in scroll
is there any way to exclude private forums' topic from scroll ?

thanks Very Happy

_________________
چهار گوش - طراحی وب - مجله طراحی وب
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14279

X last post and simple rewrite modPosted: Fri Jun 16, 2006 4:24 pm    Post subject: Re: X last post and simple rewrite mod

Nice work.

For the auth thing try changing this :
Code:

   if ($is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))


To this:
Code:

   if ($is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_view'] && $is_auth_ary[$last_topic_data[$i]['forum_id']]['auth_read'] && !in_array($last_topic_data[$i]['forum_id'], $exclude_forum))


and make sure you are not logged (or auto logged) when testing, because this is supposed to show you what you have the right to.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB Forum
Page 1 of 2 Goto page 1, 2  Next

Navigation Similar Topics

Jump to: