how to include any html/php page into home page or any page?

Discuss everything related to ApPHP MicroCMS. Any questions related to developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

chirng
Master
Master
Posts: 150
Joined: Jun 7th, '09, 04:15

how to include any html/php page into home page or any page?

Postby chirng » Nov 14th, '14, 02:24

Dear Sir,

I would like to know how to include any html/php page into home page or any other pages, please advise, TQ.

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

Re: how to include any html/php page into home page or any page?

Postby administrator » Nov 16th, '14, 19:08

templates/{your template}/default.php

Code: Select all

<?php
if((Application::Get('page') != '') && file_exists('page/'.Application::Get('page').'.php')){
    include_once('page/'.Application::Get('page').'.php');
}else if((Application::Get('user') != '') && file_exists('user/'.Application::Get('user').'.php')){
    if(Modules::IsModuleInstalled('users')){   
        include_once('user/'.Application::Get('user').'.php');
    }else{
        include_once('user/404.php');
    }
}else if((Application::Get('admin') != '') && file_exists('admin/'.Application::Get('admin').'.php')){
    include_once('admin/'.Application::Get('admin').'.php');
}else{
    if(Application::Get('template') == 'admin'){
        include_once('admin/home.php');
    }else{                              
        include_once('page/pages.php');                              
    }
}
?>


Add there call to home.php and create such page in page/ directory

chirng
Master
Master
Posts: 150
Joined: Jun 7th, '09, 04:15

Re: how to include any html/php page into home page or any page?

Postby chirng » Nov 17th, '14, 03:03

do you means, add include_once('page/my_ownpage.php'); inside below content?

if(Application::Get('template') == 'admin'){
include_once('admin/home.php');
}else{
include_once('page/pages.php');
include_once('page/my_ownpage.php');
}

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

Re: how to include any html/php page into home page or any page?

Postby administrator » Nov 17th, '14, 18:57

Yes, something like this, you may define any rule you need.

chirng
Master
Master
Posts: 150
Joined: Jun 7th, '09, 04:15

Re: how to include any html/php page into home page or any page?

Postby chirng » Nov 18th, '14, 08:39

feedback about the bug, after a day, I can't login the admin page mydomain/index.php?admin=home,.. even I copy back the original default.php file also not running, how do I debug it? Please find attched error image,
error.jpg
error.jpg (15.43 KiB) Viewed 5028 times



please advise.

TQ

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

Re: how to include any html/php page into home page or any page?

Postby administrator » Nov 18th, '14, 15:31

In this page chech the code that Check if user is logged in: if($objLogin->IsLoggedIn...

chirng
Master
Master
Posts: 150
Joined: Jun 7th, '09, 04:15

Re: how to include any html/php page into home page or any page?

Postby chirng » Nov 20th, '14, 03:37

ok, the above mentioned issues have been resolved, but I would like to know how to create my own text area of Home Page, perhaps I want to let Home Page as a link page, so that we can create our own Home Page text area to become our customized page, just like other kind of new page, we can make the text area more creative, please advise.

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

Re: how to include any html/php page into home page or any page?

Postby administrator » Nov 20th, '14, 19:27

how to create my own text area of Home Page

Explain please what do you mean?

chirng
Master
Master
Posts: 150
Joined: Jun 7th, '09, 04:15

Re: how to include any html/php page into home page or any page?

Postby chirng » Nov 21st, '14, 01:41

the current Home Page is header + text area, can we remove the text area and replace our own page? like include something.php or let the Home Page forward to another url page? or How to set the Home page to another new page which created by ourselves?

administrator
Site Admin
Site Admin
Posts: 6011
Joined: Jan 7th, '09, 23:18
Contact:

Re: how to include any html/php page into home page or any page?

Postby administrator » Nov 23rd, '14, 06:45

I don't really understand what you mean.
1. You may redo link of Home page in include/classes/Menu.class.php
2. When you create your own php page for hoe page you may add to it any content you want, including html or javascript.


Return to “ApPHP MicroCMS Talk {developers/users}”