Jump to content
DevFuse Forums
Sign in to follow this  

[IPB 2.3.x] Create an IPB components location page


Instead of placing your mods location in the lang_online.php file, IPB 2.3.x offers you the ability to add a mods location without editing files.

This file should be placed in the sources/components_location/ folder and be named to reflect your component. I find it easier to name the components_public and components_location file the same.

Here is an example of an components_location file.

[codebox]<?php

if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly.
If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}

class components_location_news
{
var $ipsclass;

function get_session_variables()
{
return array( '1_type' => 'news',
'1_id' => $this->ipsclass->input['id'],
);
}

function parse_online_entries( $array=array() )
{
$this->ipsclass->load_language( 'lang_news' );

$return = array();

if ( is_array( $array ) and count( $array ) )
{
foreach( $array as $session_id => $session_array )
{
$return[ $session_id ] = array_merge( $session_array, array(
'_url' => $this->ipsclass->base_url.'autocom=news',
'_text' => $this->ipsclass->lang['viewing_news'], '_parsed' => 1 ) );
}
}

return $return;
}
}
?>[/codebox]

You would of course change the component key [b]news[/b] to your components key. This is a very simple example of what you can do, you also have the ability to assign a location for individual pages of your component.

You can find more examples in sources/components_location/chat_sigma.php and chat_para.php including more details on the functions within the files.


Recommended Comments

There are no comments to display.

×
×
  • Create New...