Sign in to follow this  
Followers 0

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


Description

Will show you how to create your own components public page
First to start off with open an ftp program / find your forums folder / sources / components_public
Download and open the file example.php as you can see Matt has a simple example.

Step 1. Open notepad copy the below text and save it as yourpage.php

[code]<?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 component_public
{
var $output = "";
var $page_title = "";
var $nav = array();
var $html = "";
var $ipsclass;

/*-------------------------------------------------------------------------*/
// Run Component
/*-------------------------------------------------------------------------*/

function run_component()
{
$this->ipsclass->load_language('lang_yourpage');
$this->ipsclass->load_template('skin_yourpage');
$this->base_url = $this->ipsclass->base_url;

$this->main();

$this->nav[] = "<a href='{$this->ipsclass->base_url}autocom=yourpage'>{$this->ipsclass->lang['page_title']}</a>";
$this->page_title = $this->ipsclass->lang['page_title'];

$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->vars['board_name']." - ".$this->page_title, 'JS' => 0, NAV => $this->nav ) );
}

/*-------------------------------------------------------------------------*/
// Main
/*-------------------------------------------------------------------------*/
function main()
{
global $ipsclass;

$this->output .= $this->ipsclass->compiled_templates['skin_yourpage']->main();

}


}
?>[/code]

Step 2. Open your AdminCP / LOOK & FEEL / Select your skin / Edit Template HTML / All Global HTML / down the bottom click Add Template Bit

New Template Bit Name: main
Or Create New Group: yourpage
Click Continue / In the text box copy and paste the below code into it and Click Save Template

[code]<div class='borderwrap'>
<div class="maintitle">{$this->ipsclass->lang['welcome_message']}</div>
<table width='100%' cellpadding='4' cellspacing='1'>
<tr><td class='row2' width='100%' align='left'>{$this->ipsclass->lang['welcome_message']} {$this->ipsclass->member['name']} <br />
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla erat libero, posuere non, adipiscing vel, aliquam vitae, metus. Integer elementum viverra elit. Aenean quis odio at nisl viverra cursus. Phasellus nibh. Nulla tellus est, aliquam a, consequat ac, sodales elementum, arcu. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce mi. In hac habitasse platea dictumst. Nullam est erat, dapibus eu, tempor eget, molestie nec, massa. Mauris eu enim sit amet magna dapibus sodales. Nulla hendrerit mauris eget purus. Fusce enim magna, luctus placerat, ornare eget, venenatis sit amet, magna. Proin tellus.</td></tr>
</table>
</div>[/code]

Step 3. Open notepad and copy the following code, save this as lang_yourpage.php

[code]<?php

$lang = array
(

'page_title' => "Your Page",
'welcome_message' => "Welcome to Your Page",

);
?>[/code]

Step 4. Upload all the files as described below
yourpage.php -> sources/components_public
lang_yourpage.php -> cache/lang_cache/en

Step 5. You can access your file from [url="http://www.yourforum.com/index.php?autocom=yourpage"]http://www.yourforum.com/index.php?autocom=yourpage[/url]



0 Comments

There are no comments to display.