Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Tutorial:: How to make a custom home page

Tutorial:: How to make a custom home page

Many PHP-Fusion users ask these same two questions many times.

How do I make a custom home page?
How do I exclude news from the main page?


Here is how to do it.


________________________________________________



Making The Home Page File
First off we need a file that calls the PHP-Fusion maincore header and footer.
  • Copy the code below then paste into notepad++ or whatever software you use to code with.
  • Save the file naming it whatever you want your home page to be called.
  • Some suggestions for good home page names are home.php, front_page.php, or start.php
  • Upload the file to your PHP-Fusion sites main root directory.


CodeDownload  
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright © 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";

require_once THEMES."templates/footer.php";
?>




________________________________________________



Adding Panels To Your New Home Page
Now you have made your home page file and uploaded it to your site the next thing we will do is we will want to display some panels on it.

If we want Centre Panels to display on the new home page but we do not want the panels to display on any other page other than the new home page we do that through the Admin >>> System >>> Panels Administration on your site.

  • Go to Admin >>> System >>> Panels
  • Select Add New Upper or Lower Centre Panels
  • Select the panel you wish to use for your home page only from the panels dropdown list.
  • Go to the Panel Restriction text box and enter the name of your new home page like so /home.php
  • Select Include on these pages
  • Select Display panel on all pages
  • Set access
  • Enter your Admin Password
  • Save and enable the panel.



www.phpfusionmods.co.uk/forum/attachments/panel_restriction.png


________________________________________________



Setting Up Your Site To Open With Your New Home Page
Now we need to set up your site so that the opening page is now your new home page.

  • Go to Admin >>> Settings >>> Main
  • Scroll down to site Opening page and enter the name of your new home page like so /home.php
  • Done.



That's it done, your new home page is now set up.


________________________________________________



Some Ideas for Panels To Display on Your New Home Page
Here are two panels which I recommend for use with your new home page.

FP News Panel

www.phpfusionmods.co.uk/downloads/images/fp_news_panel_preview.png

FP New Panel is ideal for displaying news on your new home page you can display the news the standard single column way or double column.

FP Latest Downloads Panel

www.phpfusionmods.co.uk/downloads/images/fp_latest_downloads_panel_preview.png

This Latest Downloads Panel is great for home pages displays latest downloads in a nice centre panel with image thumbs and other various Downloads stats.
WOW!!

Thanks a lot Fangree. Really nice post! It'll help a lot or people!

I'm also currently working on a personal home page, but I think that I'll include all panels and code directly into home.php (or whatever I'll call it at the end).


But really really great post!
Of course if you do not use php-fusion v7.02 panels can be added directly into the home page file. However when using 7.02 no need to place anything in the file since panels can now be included exactly where you want them so all is good.

Quote

Fangree_Craig wrote:

Of course if you do not use php-fusion v7.02 panels can be added directly into the home page file. However when using 7.02 no need to place anything in the file since panels can now be included exactly where you want them so all is good.



Yes, of course.

I do use php-fusion, but I want my homepage to use a different design as the rest of the website. :)
That tooo can be done using panels.

Want an example?

Lets say you want the layout to be 2 rows and 3 collumns so in a empty Center panel we add the table like so......


CodeDownload  
echo"<table style='width: 100%;' border='0' align='center'>
<tr>
<td>";
echo" a code here";
echo"</td>";
echo"<td>";
echo" another code";
echo"</td>";
echo"<td>";
echo"a code again.";
echo"</td>
</tr>
<tr>";
echo"<td>";
echo"anoter code";
echo"</td>";
echo"<td>";
echo"More code";
echo"</td>";
echo"<td>";
echo cooooode";
echo"</td>
</tr>
</table>";



In between all the <td></td> s this is where you include the panels you want to display on the page.

Of course the <td> might need some style like set a width and vertical-align:top; etc to get it to look good but play around it will work eventually.

Basically 1 centre panel to display all your sites panels. hehe.
Damn Craig is really useful. Gotta remember that...:P

TD? Arent that deprecated? Sorta?
I mean it works but everyone is so into using divs and css positioning...
Well of course you can always use divs instead but that is how to do it using a table.

I will show a div example soon k.
Well, I just make a custom page and use the link to that page as my homepage address. Isn't that much easier?
It can be if you want your site link looking like mysite.com/viewpage.php?page_id=30000, looks terrible imo.
Can use SEO infusion. But, no worry there, we'll soon have SEO.
This thread is old look at my last post, think it got spammed thus the reason its bumped but look at my last post date lol

Anyway your reply is still valid so aye seo aye. :G
Oh. My bad :D
:D
This totally still works and is awesome. My problem was I had panels appearing above the content and silly me didn't think to make them Lower Panels so I created the page as a panel and it works. When editing the code I realized I totally forgot to include:

CodeDownload  
require_once "maincore.php";
require_once THEMES."templates/header.php";

require_once THEMES."templates/footer.php";



It didn't seem to make any difference or throw errors without that code and everything appeared just fine, which is odd.

I am using HTML with my page so it looks like this:

CodeDownload  
<?php
Information always included........
require_once "maincore.php";
require_once THEMES."templates/header.php";

require_once THEMES."templates/footer.php";
?>

<HTML>My Page text</HTML>

<?php
?>



My question is, does it make a difference if the code
CodeDownload  
Vrequire_once "maincore.php";
require_once THEMES."templates/header.php";

require_once THEMES."templates/footer.php";



is at the top or bottom of the page? And is my code formatted properly for using HTML inside PHP?
You are mixing the terms some here, I am not entirly sure what you are creating.

Panel is one thing. Customfile as in myfile.php and Custompages as in viewpage.php?xx is two other things.
Panels and custompages do not require includes such as,
require_once "maincore.php";
require_once THEMES."templates/header.php";
require_once THEMES."templates/footer.php";

When you make a new file that you link to, then includes are required.
Your above format are a tad off,it should be

CodeDownload  
<?php
require_once "maincore.php";
require_once THEMES."templates/header.php";
?>

<HTML>My Page text</HTML>

<?php
require_once THEMES."templates/footer.php";
?>


I apologize as my post was a little confusing.I was trying to explain what I had done to avoid some issues I was experiencing with panels displaying before my page content. I used the code to create a page. When I created the page, I had panels appearing above the page content. At the time I was not thinking those panels were set as Upper Panels. I left the page but did not link to it. Thinking I'd later ask for help here with it.

I used the code for my page I had created for my page and yes, including this code and I created a panel for the page. I did not create the panel through the System Admin>Panels area, I manually uploaded it as a panel named name_page_panel and set it as an Upper Panel and put it at the very top and it did work. That is when I realized the other panels were also set as Upper Panels and that's why they appeared above my page content. You are correct, panels created through System Admin>Panels would probably not even allow that code and do not require it at all.

After realizing why the panels were appearing before my page content, I made them all Lower Panels and everything has now worked out just fine, except I just ran into a few issues with changing text colors and a few other things when I had all the code at the top instead of the footer code being at the bottom where it should be.

Thanks very much for your clarification on this Falk.
Thread Information
Author
Replies
16 posts
Views
15,114 times
Last Post
Last updated on 4 years ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, Homdax, Craig, Kevin Maschke, Chan, i7Grendel, SkeeredOfMyMind