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 Include issues

Featured Replies

Hi, Just wondering if anyone can help me out. I am working on my ow personal website, and would like to build a one page scrolling website using php includes (To make easier to manage each page)

 

I have built the structure, and included the head.php file that links to the css etc. I have also included a footer.php file and this works correctly.

 

As this is going to be a one page scrolling site, I thought I would be able to have a section for each page and simply include that page via the php include method, however no content from these pages will display.

 

Here is the code for my index.php page

 

Thanks.

 

<!DOCTYPE html> 
<html lang="en">

<html>

<!-- Website Head -->
<?php
include 'includes/head.php';
?>

<body>
<div id="main_container"> 

<!-- Website Pages -->

<section id="home">
<?php include 'pages/home.php'; ?>
</section>

<section id="portfolio">
<?php include 'pages/portfolio.php'; ?>
</section>

<section id="services">
<?php include 'pages/services.php'; ?>
</section>

<section id="contact">
<?php include 'pages/contact.php'; ?>
</section>

<!-- Website Footer -->     
<?php
include 'includes/footer.php';
?>

</div>
</body>
</html>

Edited by Chris H

  • Author

Are the paths to the includes correct relative to the index file?

 

I believe so. the index file is in the root directory and the pages that are not displaying are in a file called pages.

 

So the link is "include 'pages/about.php';"

 

Thanks for the quick response.

D'oh, spotted it. Nope, that's not it.

 

Put this at the top of your file to see what you did wrong:

 

<?php error_reporting(E_ALL); ?>

Edited by Renaissance-Design

  • Author

D'oh, spotted it.

 

Put this at the top of your file to see what you did wrong:

 

<?php error_reporting(E_ALL); ?>

 

I take it that goes at the top of the index file, Nothing happens, I have tried it on other pages as well.

  • Author

Not to worry, it is all sorted now, For some reason Dreamweaver was not saving the index.php file in the correct location, so the local server was still picking up an old version.

 

Sorry to bother you, and thank you fr your help.

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.