CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0 »  Show posts from    to     

Icy Phoenix


Documentation And How To - CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0



Mighty Gorgon [ Thu 02 Aug, 2012 22:49 ]
Post 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) [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) [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) [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) [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: [Hide] [Select]
    Name: My Fantastic Page
    PageID: mypage
    filename: mypage.php



Enjoy your newly created pages!


DWho [ Sat 04 Aug, 2012 13:14 ]
Post 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....



Gianni PB [ Sat 04 Aug, 2012 15:11 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Thanks!

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


ThE KuKa [ Sat 04 Aug, 2012 22:21 ]
Post 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...

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

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


mort [ Sun 05 Aug, 2012 05:29 ]
Post 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. ;(


Gianni PB [ Mon 06 Aug, 2012 10:39 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Kuka it works thanks

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


mort [ Tue 07 Aug, 2012 05:19 ]
Post 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.


ThE KuKa [ Tue 07 Aug, 2012 12:45 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Code: [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: [Hide]
  1. page_header($user->lang['NEW_LANG_VAR']); 

OPEN ip/languages/lang_english/land_main.php file

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

BEFORE ADD:
Code: [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!!!


Mighty Gorgon [ Tue 07 Aug, 2012 16:49 ]
Post 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.


My4ECGI7p19Y [ Wed 29 Aug, 2012 10:07 ]
Post 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!


Limun [ Fri 08 Feb, 2013 10:41 ]
Post 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


Mighty Gorgon [ Tue 19 Feb, 2013 23:13 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Which error do you have?


Silverman [ Wed 21 Aug, 2013 12:48 ]
Post 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?


Mighty Gorgon [ Wed 21 Aug, 2013 18:26 ]
Post 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.


Silverman [ Thu 22 Aug, 2013 05:18 ]
Post 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.)


Mighty Gorgon [ Sun 25 Aug, 2013 19:30 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Sorry, but I have just tried on my setup and it is working as expected.

Are you sure you have added the page to "Standard Pages" in CMS?

You need to add the page with the correct filename and then add the blocks from CMS.


Silverman [ Mon 26 Aug, 2013 00:17 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Okay I am going through the steps here as I did them and see if I missed anything.

1. created guildrules.php and pasted inside the first code snippet from method 2. modified the name of the .tpl
2. created guildrules.tpl and pasted inside the code snippet from method 2.
3. saved both
4. uploaded via ftp as follows
(root)/guildrules.php
(root)/templates/default/guildrules.tpl
5. checked the page and it generated without error
6. went into cms added the page with this info and submitted.
Name: Guild Rules
Page ID: guildrules
Breadcrumbs: yes
View Permission: ALL
7. then added on block left (Nav Links) on right block did (User Block and Recent)
8. go to page to see if anything changed.

Blocks do not appear.

Checked logs internally and no error.
Checked logs for the server and no error.
Checked permissions of both files versus other files in their respective directories and they match.

Everything else works just fine.


Limun [ Mon 26 Aug, 2013 08:53 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
i think i found the reason why doesnt work I think
after few hours of searching my page finaly showed up

where is the problem ... now this is the best part

MG did a little mistake in his first post for option 2
this is correct
Code: (mypage.php) [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);

// 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'], '', '');

?>


do you see the difference ?
a little space on first line <?php

can you confirm this Silverman ?


Silverman [ Tue 27 Aug, 2013 18:55 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Checked the file, and even re-copied the file and uploaded, no change. I am going to reupload IP and see if that fixes it.

[UPDATE 1]IP is uploaded again, and no change.

Something else that is funny and this may help find the overall issue.
My navigation will not show a link to the file either.


[UPDATE 2]Correction, the default site map doesn't add the link but a custom menu block will.


Limun [ Wed 28 Aug, 2013 07:59 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
can you be more specific please , i dont understand

does the site show up when you click preview ?

cms_1377669544_128112

can you post here your guildrules.tpl and guildrules.php here


Silverman [ Wed 28 Aug, 2013 09:52 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Yes the page shows up but without the blocks as I assigned in the Standard Pages.

guildrules.php exact copy
Code: [Hide]
  1. <?php 
  2. /** 
  3. * @package Icy Phoenix 
  4. * @version $Id$ 
  5. * @copyright (c) 2008 Icy Phoenix 
  6. * @license http://opensource.org/licenses/GPL-license.php GNU Public License 
  7. */ 
  8.  
  9. define('IN_ICYPHOENIX', true); 
  10. if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './'); 
  11. if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); 
  12. include(IP_ROOT_PATH . 'common.' . PHP_EXT); 
  13.  
  14. // Start session management 
  15. $user->session_begin(); 
  16. $auth->acl($user->data); 
  17. $user->setup(); 
  18. // End session management 
  19.  
  20. $mycontent = '<b>My Fantastic Page</b>'; 
  21.  
  22. $template->assign_vars(array( 
  23. 'MYCONTENT' => $mycontent 
  24. ); 
  25.  
  26. full_page_generation('guildrules.tpl', $lang['MYCONTENT'], '', ''); 
  27.  
  28. ?>  


guildrules.tpl exact copy
Code: [Hide]
  1. <!-- INCLUDE overall_header.tpl --> 
  2. {MYCONTENT} 
  3. <!-- INCLUDE overall_footer.tpl --> 


Edit Site Page
Code: [Hide] [Select]
Name: Guild Rules
PageID: guildrules
filename: guildrules.php
Page Navigation Block (Breadcrumbs): Off (have tried both)
View Permissions: ALL


Mighty Gorgon [ Wed 28 Aug, 2013 11:07 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Ok, I found the error.

I missed in the first version to add the PAGE_ID which is needed to display blocks and allows to use the AUTH system.

If you check again the first post, now the guide should work.

For your records, you need to add this to page top after inclusion of COMMON.PHP:

Code: [Hide] [Select]
$cms_page['page_id'] = 'guildrules';


After this small edit everything should work without further edits.

Here is the altered code of the file you posted:
Code: [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'] = 'guildrules';

// 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('guildrules.tpl', $lang['MYCONTENT'], '', '');

?>


Silverman [ Wed 28 Aug, 2013 11:52 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
That did it thank you everyone blocks are showing and changing just fine.


Mighty Gorgon [ Thu 29 Aug, 2013 11:56 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Great!


AndyGpy [ Mon 20 Jan, 2014 01:30 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
HI All

I recently started playing with IP2.0, i have made a standard page but i would like to know how i address a database outwith IP ( on same server but a seperate database ). Also since upgrading to PHP5.5 and appache 2.4.6, the following line is no longer effective.

include(IP_ROOT_PATH . 'alerts/alertsconfig.'.PHP_EXT);

was fine on PHP5.3 and appache 2.2

Appreciate any guidance as these two problems are giving me a major headache


mort [ Tue 21 Jan, 2014 05:29 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
To call another database you would need another config file (myconfig.php) with the connect strings, and then you would need to include other strings(script) that calls and parses the connection data - and how it is to be handled - to what you are writing/doing that you want to keep separate.

Maybe something like this.

myconfig.php

Code: [Hide] [Select]
$dbhost = 'localhost'; // Database host - usually localhost
$dbuser = ''; // Database User Name
$dbpass = ''; // Database Password
$dbname = ''; // Database Name
$dbpre = 0;



Your Page:

Code: [Hide] [Select]
include "myconfig.php";
error_reporting(E_ALL);
$server = $dbhost;
$dbuser = $dbuser;
$dbpass = $dbpass;
$dbname = $dbname;

$x = mysql_connect($server,$dbuser,$dbpass) or die(mysql_error());
mysql_select_db($dbname,$x);


No doubt you will also have to address or re-define some CONSTANTS and variables - and then the whole thing will get messier.

There may be an easier way - - - - - - Dunno!


Mighty Gorgon [ Tue 21 Jan, 2014 16:00 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
AndyGpy wrote: [View Post]
I recently started playing with IP2.0, i have made a standard page but i would like to know how i address a database outwith IP ( on same server but a seperate database ).

What do you mean by "address a database"? Do you need to run SQL on another DB?

AndyGpy wrote: [View Post]
Also since upgrading to PHP5.5 and appache 2.4.6, the following line is no longer effective.

include(IP_ROOT_PATH . 'alerts/alertsconfig.'.PHP_EXT);

was fine on PHP5.3 and appache 2.2

Appreciate any guidance as these two problems are giving me a major headache

What do you mean by "no longer effective"... that is just an inclusion... and it should work even on PHP 5.5!


Please open 2 specific topics in the General Support section... as they are not linked any more to this topic.


yogeshpaji [ Tue 27 Jun, 2023 08:05 ]
Post subject: Re: CUSTOMIZATION - Create A Custom Page In Icy Phoenix 2.0
Good




Powered by Icy Phoenix