CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0

Tags And Keywordscustom pages, customization


Goto page 1, 2  Next

Subject: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Since many users already asked how to create an empty page into Icy Phoenix 2.0 to insert custom content, I have decided to create this small tutorial.

There several ways to create custom pages, here are 2 different approaches:

  1. Create a CMS page (with the "central_block") and add the content into a custom block, so you can output whatever you like by creating a proper function. Just duplicate a block, and add in the function your content, something like this:
    Code: (block_myblock.php) [Download] [Hide] [Select]
    <?php
    /**
    *
    * @package Icy Phoenix
    * @version $Id$
    * @copyright (c) 2008 Icy Phoenix
    * @license http://opensource.org/licenses/GPL-license.php GNU Public License
    *
    */

    if (!defined('IN_ICYPHOENIX'))
    {
    die(
    'Hacking attempt');
    }

    if(!
    function_exists('cms_block_myblock'))
    {
    function
    cms_block_myblock()
    {
    global
    $db, $cache, $config, $template, $theme, $images, $user, $lang, $table_prefix, $block_id, $cms_config_vars, $cms_config_layouts, $cms_page;

    $mycontent = '<b>My Fantastic Page</b>';
    $template->assign_vars(array(
    'MYCONTENT' => $mycontent,
    )
    );

    }
    }

    cms_block_myblock();

    ?>

    Then you just need to create a tpl called myblock_block.tpl in templates/default/blocks/ with this content:
    Code: (myblock_block.tpl) [Download] [Hide] [Select]
    {MYCONTENT}


    Then just add the block to the page and you are done.
  2. As a second option you can create an empty PHP page like this:
    Code: (mypage.php) [Download] [Hide] [Select]
    <?php
    /**
    *
    * @package Icy Phoenix
    * @version $Id$
    * @copyright (c) 2008 Icy Phoenix
    * @license http://opensource.org/licenses/GPL-license.php GNU Public License
    *
    */

    define('IN_ICYPHOENIX', true);
    if (!
    defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
    if (!
    defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
    include(
    IP_ROOT_PATH . 'common.' . PHP_EXT);

    $cms_page['page_id'] = 'mypage';

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
    // End session management

    $mycontent = '<b>My Fantastic Page</b>';

    $template->assign_vars(array(
    'MYCONTENT' => $mycontent
    )
    );

    full_page_generation('mycontent_body.tpl', $lang['MYCONTENT'], '', '');

    ?>

    Then you just need to create a tpl called mycontent_body.tpl in templates/default/ with this content:
    Code: (mycontent_body.tpl) [Download] [Hide] [Select]
    <!-- INCLUDE overall_header.tpl -->
    {MYCONTENT}
    <!-- INCLUDE overall_footer.tpl -->


    Then in CMS => Standard Pages create the new page so you can add blocks and specify other features:
    Code: [Download] [Hide] [Select]
    Name: My Fantastic Page
    PageID: mypage
    filename: mypage.php



Enjoy your newly created pages! :mri:

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Thanks for the tutorial, I am sure it will help a great many users....

:mrgreen: :mrgreen:

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Thanks! :)

How can I set a page title with the second option?

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Gianni PB wrote: [View Post]
Thanks! :)

How can I set a page title with the second option?


TEST... :idea:

FIND:
Code: [Download] [Hide]
  1. $user->setup(); 
  2. // End session management 

AFTER ADD:
Code: [Download] [Hide]
  1. page_header('YOUR TITLE HERE');` 

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Not sure if it hasn't been changed to this?

Examples?

// Load and process templates

$meta_content['page_title'] = $lang['Group_Control_Panel'];
page_header($meta_content['page_title'], true);

default:

$meta_content['page_title'] = $lang['Mod_CP'];
page_header($meta_content['page_title'], true);

The $lang obviously being the title?

So many changes, its difficult to know for sure without testing them. ;(

Profile PM  
Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Kuka it works thanks 8)

mort you have to add it in your .php files (in case of 2nd option)

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
page_header('YOUR TITLE HERE');` doesn't seem to exist any more like it used to with v*53? and looks like it has been replaced or superseded with the alternative I posted. That not only adds the header location/name to the tab, it also adds the page title to the meta data from what I can see.

Profile PM  
Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Code: [Download] [Hide]
  1. page_header('YOUR TITLE HERE'); 

Works perfect in custom pages phpBB3 and Icy Phoenix 2.0 (in my test).

Can test other alternative with new var language:
Code: [Download] [Hide]
  1. page_header($user->lang['NEW_LANG_VAR']); 

OPEN ip/languages/lang_english/land_main.php file

FIND:
Code: [Download] [Hide]
  1. //==================================================== 
  2. // Do not insert anything below this line 
  3. //==================================================== 
  4.  
  5. ?> 

BEFORE ADD:
Code: [Download] [Hide]
  1. // NEW PAGE TITLE - START 
  2. $lang = array_merge($lang, array( 
  3. 'NEW_LANG_VAR' => 'YOUR TILE PAGE', 
  4. )); 
  5. // NEW PAGE TITLE - END 

¡¡¡TEST AGAIN!!! :mrgreen:

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
You have at least two options to insert a title:

  1. Define $lang['MYCONTENT'] with the content you need (if you use the lang I added in my example full_page_generation('mycontent_body.tpl', $lang['MYCONTENT'], '', '');)
  2. Define $meta_content['page_title'] with the content you need


Both should produce the same result.

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Thanks man! Had this problem, and didn't know how to deal with it until now! :)

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
option 2 doesnt work for me
where is the problem?

i created mycontent.php with code 2 in first post and puted it to root
than i created mycontent_body.tpl and puted it into templates/default/ with some simple html

i m using IP2.0 on localhost

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Which error do you have?

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
What would I need to add to get new pages in method 2 to show blocks defined in the CMS?

Profile PM  
Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
If you add the page to "Standard Pages" you should then be able to add CMS blocks in standard positions... let me know if you succeed.

Subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
I did and added the blocks in the cms like normal, I see the "My Fantastic Page" but the blocks don't show.

(I kept the files retrying it as is until I get it sorted.)

Profile PM  
Goto page 1, 2  Next

Page 1 of 2


  
You cannot post new topics
You cannot reply to topics
You cannot edit your posts
You cannot delete your posts
You cannot vote in polls
You cannot attach files
You can download files
You cannot post calendar events

   

This is a "Lo-Fi" version of our main content. To view the full version with more information, formatting and images, please click here.

Powered by Icy Phoenix based on phpBB
Generation Time: 1.0949s (PHP: 2% SQL: 98%)
SQL queries: 32 - Debug Off - GZIP Enabled