| :: |
| Author |
Message |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Wed May 28, 2008 2:59 pm Post subject: Block News in portal with URL SEO |
|
|
Hi, I would like use URL SEO in the block news of Phpbb3 Portal.
I give the code for if you can help me.
| Code: | <?php
/*
*
* @package phpBB3 Portal a.k.a canverPortal ( www.phpbb3portal.com )
* @version $Id: news.php,v 1.5 2008/02/09 08:18:14 angelside Exp $
* @copyright (c) Canver Software - www.canversoft.net
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') or !defined('IN_PORTAL'))
{
die('Hacking attempt');
exit;
}
/**
*/
//
// Fetch Posts for news from portal/includes/functions.php
//
if (!isset($HTTP_GET_VARS['article']))
{
$fetch_news = phpbb_fetch_posts($config['portal_news_forum'], $config['portal_number_of_news'], $config['portal_news_length'], 0, ($config['portal_show_all_news']) ? 'news_all' : 'news');
if (count($fetch_news) == 0)
{
$template->assign_block_vars('news_row', array(
'S_NO_TOPICS' => true,
'S_NOT_LAST' => false
));
}
else
{
for ($i = 0; $i < count($fetch_news); $i++)
{
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
{
$open_bracket = '[ ';
$close_bracket = ' ]';
$read_full = $user->lang['READ_FULL'];
}
else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
}
$template->assign_block_vars('news_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'U_USER_PROFILE' => (($fetch_news[$i]['user_type'] == USER_NORMAL || $fetch_news[$i]['user_type'] == USER_FOUNDER) && $fetch_news[$i]['user_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $fetch_news[$i]['user_id']) : '',
'TIME' => $fetch_news[$i]['topic_time'],
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'U_LAST_COMMENTS' => $phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id'],
'U_VIEW_COMMENTS' => append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&f=' . $fetch_news[$i]['forum_id']),
'U_POST_COMMENT' => append_sid($phpbb_root_path . 'posting.' . $phpEx . '?mode=reply&t=' . $fetch_news[$i]['topic_id'] . '&f=' . $fetch_news[$i]['forum_id']),
'U_READ_FULL' => append_sid($_SERVER['PHP_SELF'] . '?article=' . $i),
'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket,
'S_NOT_LAST' => ($i < count($fetch_news) - 1) ? true : false,
'S_POLL' => $fetch_news[$i]['poll'],
'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'),
));
}
}
}
else
{
$fetch_news = phpbb_fetch_posts($config['portal_news_forum'], $config['portal_number_of_news'], 0, 0, ($config['portal_show_all_news']) ? 'news_all' : 'news');
$i = intval($HTTP_GET_VARS['article']);
$template->assign_block_vars('news_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'TIME' => $fetch_news[$i]['topic_time'],
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'U_LAST_COMMENTS' => $phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id'],
'U_VIEW_COMMENTS' => append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&f=' . $fetch_news[$i]['forum_id']),
'U_POST_COMMENT' => append_sid($phpbb_root_path . 'posting.' . $phpEx . '?mode=reply&t=' . $fetch_news[$i]['topic_id'] . '&f=' . $fetch_news[$i]['forum_id']),
'S_POLL' => $fetch_news[$i]['poll']
));
}
// Assign specific vars
$template->assign_vars(array(
'S_DISPLAY_NEWS' => true,
));
?> |
Thanks |
|
|
| Back to top |
|
 |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
|
| Back to top |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Thu Jul 03, 2008 12:50 pm Post subject: Re: Block News in portal with URL SEO |
|
|
Hi of new.
I have add more news in portal and URL SEO not found.
Can you help me now?
Thanks |
|
|
| Back to top |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3477
|
|
| Back to top |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Thu Jul 03, 2008 1:58 pm Post subject: Re: Block News in portal with URL SEO |
|
|
Sorry, I dont explain good.
The URL SEO isnt show in portal news, It show viewtopic.php and I want only show the URL SEO in news block of portal.
Thanks |
|
|
| Back to top |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3477
|
|
| Back to top |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Thu Jul 03, 2008 2:02 pm Post subject: Re: Block News in portal with URL SEO |
|
|
| Before It found correct because I have only 5 news in portal, now i have 8 news and it isnt correct :S |
|
|
| Back to top |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3477
|
Posted: Thu Jul 03, 2008 2:20 pm Post subject: Re: Block News in portal with URL SEO |
|
|
Ho I get it, it's just that some of your news apeared to be global anoounces as well, so they where handled by the other script.
For this one, the news one, add :
| Code: | if ( empty($phpbb_seo->seo_url['topic'][$fetch_news[$i]['topic_id']]) ) {
if ($fetch_news[$i]['topic_type'] == POST_GLOBAL) {
$phpbb_seo->seo_opt['topic_type'][$fetch_news[$i]['topic_id']] = POST_GLOBAL;
}
$phpbb_seo->seo_url['topic'][$row['topic_id']] = $phpbb_seo->format_url(censor_text($fetch_news[$i]['topic_title']));
} |
After :
| Code: | else
{
$open_bracket = '';
$close_bracket = '';
$read_full = '';
} |
and after :
| Code: | | $fetch_news = phpbb_fetch_posts($config['portal_news_forum'], $config['portal_number_of_news'], 0, 0, ($config['portal_show_all_news']) ? 'news_all' : 'news'); |
Same code two times.
Note that if you are using virtual folder, it will only work with the forum cache url activated.
To have the post url rewritten as well, just replace :
| Code: | | $phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id'] |
with :
| Code: | | append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $fetch_news[$i]['topic_id'] . '&p=' . $fetch_news[$i]['topic_last_post_id']) |
Again, two times |
_________________ phpBB SEO || SEO Forum || Forum Référencement
GYM Sitemap & RSS for phpBB3 has been released ! || GYM Sitemap & RSS for phpBB3 est disponible ! |
|
| Back to top |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Thu Jul 03, 2008 2:43 pm Post subject: Re: Block News in portal with URL SEO |
|
|
Can you give the final correct code?
I cant do it, it isnt found :S
Thanks |
|
|
| Back to top |
|
 |
SeO Administrateur - Site Admin

Joined: 15 Mar 2006 Posts: 3477
|
|
| Back to top |
|
 |
PDD_20
Joined: 23 May 2008 Posts: 31 Location: Spain
|
Posted: Thu Jul 03, 2008 2:52 pm Post subject: Re: Block News in portal with URL SEO |
|
|
I do the changes but it is same.
See my portal: www.elgrupoinformatico.com
The 4 first news have URL SEO but the lasts news havent URL SEO.
Thanks |
|
|
| Back to top |
|
 |
|
|