Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

php 'includes' functionality - options and alternatives - e.g. HTML, ASP etc

Featured Replies

Hi,

 

I want to have the functionality of php includes or ASP.net masterpages e.g. have one template page and content pages.

 

I was interested in what options I have for this. I'm only doing a small site with around 10 pages.

 

Thanks

 

Andy

Hi Andy,

 

Try the following in your main content area:

 

<?php
$page = stripslashes($_GET['page']);
if (isset($page)) {
   if (file_exists("".$page.".php")) { //Change .php to the extension of choice for pages you want to include
       include "".$page.".php"; //Again, change extension if needed
   } else {
       echo "Error: Page Not Found.";
   }
} else {
   include "mainpage.php"; //Change this to your 'news page', if you like...
}
?>

<?
function template($part) {
switch ($part) {
case "header":
insert header stuff here
break;
case "footer":
footer stuff here
break;
}
}
?>

 

Put the above in your template.php file and use:

 

<?=template("header");?>

 

to build bits - your template file can include as many bits of html as required.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.