Printable Version of Topic

Click here to view this topic in its original format

YourForum _ IPS related _ IPS Tutorials: Components and Modules > Create an IPB Components Public

Posted by: RSS Bot 31 Dec 2008, 06:42 AM

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

<?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()
          {
              global $ipsclass;
              $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();
  
          }
  
  
      }
      ?>




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

<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']}
  
      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>




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

<?php
  
      $lang = array
      (
  
      'page_title'      => "Your Page",
      'welcome_message' => "Welcome to Your Page",
  
      );
      ?>




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 http://www.yourforum.com/index.php?autocom=yourpage http://resources.invisionpower.com/index.php?appcomponent=cms&module=articles&article=7239

Posted by: sarawestlander 18 Nov 2009, 08:29 AM

USMLE step 1 and step 2 This is what helped me survive http://usmlereview.net
http://usmlereview.net
http://usmle.org

Posted by: sarawestlander 19 Nov 2009, 10:52 AM

USMLE step 1 and step 2 This is what helped me survive http://usmlereview.net
http://usmlereview.net
http://usmle.org

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)