Could someone say what´s the fastest way to load a page content: Reincludind repetitive content on every page loading or storing it as a session?
I want to include a static menu. So it should be required on every page of my website. Would someone recomend require it once and store it as a session to improve the speed for the next pages loadings?
I.e:
Page 1
<?php
require('inc/menu.php');
$_SESSION['menu'] = $sMenu;
//content goes here
?>
Page 2, 3 , 4, n...
<?php
if(isset($_SESSION['menu'])){
$sMenu = $_SESSION['menu']
}
else{
require('inc/menu.php');
}
//content goes here
?>
Note that the menu is just an example. It could be used for other includes anyway.
Thanks in advance.