Jump to content

Efficient website design?


hotdog1983

Recommended Posts

Hi all!

 

I'm a real noob and this is my first time making a website and I haven't hosted it yet.

I'm trying to make a website that is fast and secure.

My pages look something like this.

 

<?php include("header.php");include("sidebar.php"); ?>
HTML CODES
<?php include("footer.php"); ?>

 

1. Are these php files cached after their first load? When I go to another page, those parts seem to stay still.

2. Is this code secure?

 

And now I'm starting to make product pages which will be around 40 pages.

So I'm considering something like  this...

 

<?php include("header.php");include("sidebar.php"); ?>
<a href="index.php?page=a">Page A</a>
<?php 
$page = $_GET['page'];
if (file_exists('pages/'.$page.'.php'))
{
   include('pages/'.$page.'.php');
}
?>
<?php include("footer.php"); ?>

 

3. Is it better to make every page like this since it will load header, sidebar, footer only once?

4. How should I protect from the user input data, by making an array of allowed files or by prohibiting "." and "/" ?

 

Thank you in advance.

Link to comment
https://forums.phpfreaks.com/topic/219049-efficient-website-design/
Share on other sites

Thanks a lot for your reply.

 

But um... I'm still trying to understand your answer 1)

 

What I understand is that

 

In the 1st code

  The whole page will be reloaded as I surf around the website.

 

In the 2nd code

  Only the content part of the page will be loaded as I surf around the website.

 

 

Is this correct?

It's a very sloppy, unorganized website designing. I recommend you looking into Object Oriented PHP (OOP) scripting, also look into Smarty Template Engine its very cool you can have all you php scripting completely separate from your website layout. Makes editing a breeze!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.