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.

HTML5 Equivalent to PHP include

Featured Replies

Morning all,

 

I'm playing around with a new HTML5 website and instead of having to edit my header\footer\nav bar etc on every single page every time I make a change, I wondered if there is an equivalent in HTML5 to that of PHP include?

 

Probably a very daft question which one of you HTML gurus will easily answer :D

 

Thanks!

Afraid not - you'll have to resort to a small PHP snippet.

 

Some might argue that it's possible with frames, but that's really not good practice.

You can use SSI (Server Side Includes) to embed HTML into HTML, I've used it quite a few times on static pages.

 

You'll need to add a line into your .htaccess then you're good to go.

Edited by SEOLover

  • Author

Thanks Andy\SEOLover. PHP will probably be the way to go as for my header I have a li class for the current page - e.g.

 

<li class="current_page">Home</a></li>
...
<li>Contact</a></li>

(href moved due to my post count!)

 

Is there some funky PHP code which could be used to determine the current page, and apply the class to the correct link?

I'm sure there will a way of doing it.

 

What URL structure are you using? I realise you can't post links yet (and apologies for that, we're working on anti-spam techniques at the moment), so just post it like:

/category/page_one.html
And what do you want to happen with regards to classes being applied?
  • Author

I've sussed it out using a simple PHP line, should have thought about it more before posting lol :D I would post the line but it wont let me - a google for "php if current page" brought it up for me.

Guest
This topic is now closed to further replies.

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.