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.

Running html file in another html file

Featured Replies

Hi again everyone.

 

Can anyone advise me.

 

I want to call an html document that contains a drop down menu, into another html page that is a page in the site.

 

What I have tried to do, props very crudely, is create a drop down menu bar that I can use accross the entire site, and if I need to edit this menu, I only have to do it once as the file that contains it is called upon from each page in the site, if you know what i mean.

 

So I have created the menu html file, now I want to call upon it in each page of my site. What is the command I need to add into the main pages to call and run the menu file.

 

Thanks fella

I think what you are looking for is a iFrame code. very simple. Search Google or wait for another designer to post. Sorry in a rush to get out. Sorry

Just as a note, Iframes are a bad idea, to use at any time within a design. But especially when it comes to a drop down menu, as you have to specify the height of the iframe so your dropdown will not be shown in some browsers due to the iframe stopping, so you will make the site unusable for some

So php is the only decent alternative. Do both the destination file and menu file have to be in php?

both files have to have a php filename, but both can just be regular html files inside.

  • Author
both files have to have a php filename, but both can just be regular html files inside.

 

Perfect mate, Thanks........to everyone

both files have to have a php filename, but both can just be regular html files inside.

 

Not quite :)

 

An "include" file can have any file extension so long as the format associated with that extension is a text file. Examples would be php, html, txt, inc.

 

All an include does is literally "take the contents of this file and put it here" - the actual content can be plain text, or html

Including the HTML presents all sort of code / layout problems. You's also include tags like <html> <head> <body>.

 

Found an intresting topic on this subject here

 

http://drupal.org/node/40756

 

Might be drupal related but still might be informative if you really don't wanna use iframes :)

Not quite :)

 

An "include" file can have any file extension so long as the format associated with that extension is a text file. Examples would be php, html, txt, inc.

 

All an include does is literally "take the contents of this file and put it here" - the actual content can be plain text, or html

Thanks for that Bluedreamer - I have wondered from time to time if that may be the case... :)

Including the HTML presents all sort of code / layout problems. You's also include tags like <html> <head> <body>.

 

Found an intresting topic on this subject here

 

http://drupal.org/node/40756

 

Might be drupal related but still might be informative if you really don't wanna use iframes :)

This doesn't apply in this situation. The OP only wants to include a menu, not an entire website. As long as they don't include extra (unnecessary) html/head/body tags in the drop down menu file there will not be any conflicting tags/etc. In fact, if done with PHP the user won't even realise that the page is constructed from multiple files.

  • Author

In that case would I just take off the html, head and body tags from the the dropdown menu file, save it as a php and then add:

<?php

include("drop down menu.php");

?>

 

into my index.html file?

The index file needs to be saved as php, but yes, that's the general idea. (Although its bad practise to have spaces in filenames)

  • Author
The index file needs to be saved as php, but yes, that's the general idea. (Although its bad practise to have spaces in filenames)

 

Thanks for the tip friend

  • Author

When I try and view the index.php file in my browser (I'm using notepad++ to script) It just opens the file in MS Notepad, not IE. The HTML version opens fine in the browser, whats the problem with the PHP file do you think?

php is a server side script to be able to see the page you will need to run it from something as a browser cannot do this itself, so it will either have to be uploaded onto your site, or you could use a local host such as XAMPP to replicated a server.

  • Author
php is a server side script to be able to see the page you will need to run it from something as a browser cannot do this itself, so it will either have to be uploaded onto your site, or you could use a local host such as XAMPP to replicated a server.

 

Thanks for that. You just saved me alot of stressing.

 

Big up

  • Author

Thanks everyone. I just tried the php include command and it works beautiful.

 

Thanks again, a new skill learnt

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.