[Add-on] Display posts anywhere 1.2.0 RC5

Stand-alone scripts designed for a specific function, but not neccessarily part of normal forum browsing.
Forum rules
Image Please feel free to download any Scripts here, support for each Script is located it's own thread.

To post your own Script, please first read the MOD / Script Guidelines

Re: [Add-on] Display posts anywhere

Postby Handyman » 07 Feb 2007, 20:11

Thank you, that is something I never thought of.
I'll make it grab only the last number of posts that you can actually see... adding that to the next release.

Next release features are now posted in the first post.
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male


Re: [Add-on] Display posts anywhere

Postby shadowx » 09 Feb 2007, 18:25

nope still does not work
shadowx
Cadet I
Cadet I
 
Posts: 17
Joined: 04 Feb 2007, 18:27
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Handyman » 09 Feb 2007, 20:12

what still doesn't work?
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Aratgel » 18 Feb 2007, 14:42

I got time to work whit your plug-in Handy but I found 2 more little bug! if in time the reply are on subject 1 subject 2 subject3 and subject1 the plug-in don't hide the second subject1 post. It is possible to hide the RE: in re:Subject name. the second one, ome constants don't work this is the list

POSTER_JOINED
'POST_DATE'
'MINI_POST_IMG'
'U_EDIT'
and
'U_QUOTE'
Last edited by Aratgel on 18 Feb 2007, 16:03, edited 1 time in total.
Aratgel    
Translator
Translator
 
Posts: 31
Joined: 14 Jan 2007, 19:43
Location: Montréal Québec
Favorite Team: Canadiens
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Aratgel » 18 Feb 2007, 16:01

just one other thing how can i chose to list the reply from one specific subforum and subdirectory?
Aratgel    
Translator
Translator
 
Posts: 31
Joined: 14 Jan 2007, 19:43
Location: Montréal Québec
Favorite Team: Canadiens
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Handyman » 18 Feb 2007, 16:22

Hmm? your last request is not currently in there, but it could easily be done.
I'll add that to the list of possibilities for my next version which I have made some progress on, but with limited time available.
as for your first question, I don't believe I understand what you are trying to tell me.
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Aratgel » 18 Feb 2007, 17:29

when the script make a list of last reply on the forum il look like that in my website

Sujet:Re: Armure
auteur: beorg

Sujet:Re: Armure
auteur: Senion

Sujet:Re: Temple du portail
auteur: Warik

Sujet:Re: Le Portail Célestain (Ouvert à tous)
auteur: Zirka

Sujet:Re: Le Portail Célestain (Ouvert à tous)
auteur: Danor

so on the last 5 posts I have only 3 subjects so I want to show the last 5 posts in 5 differants subject and remove the "Re:" substring I supose???

for the last request, I think to all is clear. thx a lot in Advance
Aratgel    
Translator
Translator
 
Posts: 31
Joined: 14 Jan 2007, 19:43
Location: Montréal Québec
Favorite Team: Canadiens
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Handyman » 18 Feb 2007, 17:44

so basically you want it to show the last posts from the last 10 topics instead of the last 10 posts? that is how I should have done it in the first place.
I will add that.
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [Add-on] Display posts anywhere

Postby Kjell » 23 Feb 2007, 15:53

Handyman wrote:It's in the instructions.......


Post: [posts.POST_TEXT}
------^ ???? Confused
Post: {posts.POST_TEXT}
[to be or not to be] Blink

And the installationcode not function for me in version 3.0.B5 and im using phpbb3portal, but I have testing to run in separate php and html file and same results, no data on the screen Cry

Index.php
Spoiler:
'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false,

'U_MARK_FORUMS' => append_sid("{$phpbb_root_path}index.$phpEx", 'mark=forums'),
'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '')
);

//replace $postbumber with the post number that you want to pull
$postrow = get_post_contents(5);

//now for clarification, I'll just put it in a assign_vars array
template->assign_vars(array(
'POST_TEXT' => $postrow['post_text'],
'POST_SUBJECT' => $postrow['post_subject'],
));

// Output page
page_header($user->lang['INDEX']);

$template->set_filenames(array(
'body' => 'index_body.html')
);

page_footer();
?>

functions.php
Spoiler:
}

function merge($bitfield)
{
$this->data = $this->data | $bitfield->get_blob();
}
}
//Display posts anywhere
function get_post_contents($post)
{
global $db, $phpbb_root_path, $phpEx;
$icons = $cache->obtain_icons();

$sql = 'SELECT p.*, u.*
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = p.poster_id)
WHERE p.post_id = $post";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$flags = (($row['enable_bbcode']) ? 1 : 0) + (($row['enable_smilies']) ? 2 : 0) + (($row['enable_magic_url']) ? 4 : 0);
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);

return (!empty($row['post_id'])) ? $row : false;
}

function get_last_posts($limit)
{
global $db, $phpbb_root_path, $phpEx, $template;

// Grab icons
$icons = $cache->obtain_icons();

$sql = 'SELECT p.*, u.*
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = p.poster_id)
ORDER BY post_time DESC LIMIT $limit";
$result = $db->sql_query($sql);

while ($row = $db->sql_fetchrow($result))
{
$flags = (($row['enable_bbcode']) ? 1 : 0) + (($row['enable_smilies']) ? 2 : 0) + (($row['enable_magic_url']) ? 4 : 0);
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);

$template->assign_block_vars('posts', array(
'POST_AUTHOR_COLOUR'=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POSTER_JOINED' => $user->format_date($row['user_regdate']),
'POSTER_POSTS' => $row['user_posts'],
'POSTER_FROM' => $row['user_from'],
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $row['post_subject'],
'MESSAGE' => $row['post_text'],
'SIGNATURE' => ($row['enable_sig']) ? $row['user_sig'] : '',
'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'),
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p={$row['post_id']}&f={$row['forum_id']}#p{$row['post_id']}"),

'POST_ICON_IMG' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
'POST_ICON_IMG_WIDTH' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
'POST_ICON_IMG_HEIGHT' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $row['poster_id'] && $auth->acl_get('f_edit', $row['forum_id']) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $row['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$row['forum_id']}&p={$row['post_id']}") : ''),
'U_QUOTE' => ($auth->acl_get('f_reply', $row['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f={$row['forum_id']}&p={$row['post_id']}") : '',
'POST_ID' => $row['post_id'],
));
}
$db->sql_freeresult($result);
return;
}
//End Display posts anywhere

?>
Index_body.html
Spoiler:
<a target="_blank" href="http://www.opnet.se">Opnet Sw User Group</a><br>
&nbsp;»
<a target="_blank" href="http://www.asciitable.com/">Ascii-Hex
table</a><br>
&nbsp;» <a target="_blank" href="http://www.ethereal.com/">Ethereal</a><p>
<a href="http://www.help4networks.se/phpBB3/links.php">More links</a>
</tr>
</table>
<p>
<!-- BEGIN posts -->
Subject: {posts.POST_SUBJECT}
Post: {posts.POST_TEXT}
<!-- END posts -->
</td>
<td>
<!-- INCLUDE forumlist_body.html -->

</td>
</tr>
</table>
<p>&nbsp;<span class="gensmall"><a href="{U_DELETE_COOKIES}">{L_DELETE_COOKIES}</a> | <a href="{U_TEAM}">{L_THE_TEAM}</a></span><br />

<br clear="all" />

<!-- INCLUDE breadcrumbs.html -->

<!-- IF S_DISPLAY_ONLINE_LIST -->
<br clear="all" />
Last edited by Kjell on 23 Feb 2007, 17:19, edited 1 time in total.
Kjelle
My work - My farm - Ware I live - phpBB support Sweden
"The globe is round, think global", My rules: Be teased is okay on a funny way ;)
User avatar
Kjell    
Supporter
Supporter
 
Posts: 490
Joined: 14 Feb 2007, 13:09
Location: Nordic of Sweden
Favorite Team: NHL N-ville,Forsberg
Gender: Male
phpBB Knowledge: 8

Re: [Add-on] Display posts anywhere

Postby Handyman » 23 Feb 2007, 17:00

Post: {posts.POST_TEXT}
[to be or not to be] Blink

Yes, that is correct? like that.
It's already in the assigned vars for the template, so once you include the function, you only need to make template modifications for it to show up.

If you're still having trouble with it, the next version will be even easier? it will be just a basic template page include.
Updated the first post with the details.
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

PreviousNext

Return to Scripts

Who is online

Users browsing this forum: No registered users and 3 guests