Jump to content
egbertz

Including html file by object tag

Recommended Posts

One column (navigation menu) on my website is the same on all pages, so I want to embed it as an object instead of copy/paste it onto every new page (article) I create. However it shows up with horizontal end vertical scroll bars, while part of the text is hidden. I tried to use the overflow command (hidden), but that does not work.This is the code:

<object style="width:210px" data="filename.html"></object>

.

  • Like 1

Share this post


Link to post
Share on other sites

can you use a server side language and just include it? That's the typical convention.

Share this post


Link to post
Share on other sites

All my pages always contain this code:

<html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]" xml:lang="nl" lang="nl">

Is that what you mean?

Share this post


Link to post
Share on other sites

If your server supports php server language for instance, you would create a navigation page with only the html that produces the navigation( not <html><body><head> etc) then by adding <?php include("nav.html"); ?> to the area of the pages you wish the navigation to appear, they would all now reference that single nav page, and any amendments to that page instantly appears in the pages that it was included in. Using object to embed a webpage is very buggy especially for older IE versions, with problems with scrollbars, frame type borders, produces different results in different browsers..

Share this post


Link to post
Share on other sites
(...)Using object to embed a webpage is very buggy especially for older IE versions, with problems with scrollbars, frame type borders, produces different results in different browsers..
Thanks for this info. I did not know. This is what I found at W3-schools: You can also use the <object> tag to embed another webpage into your HTML document. They do not warn for the problems you're mentioning here. Anyway, I'll try php later (it's bedtime now in Europe). Thank you so much!

Share this post


Link to post
Share on other sites

Thanks! It works, mate! I never use php, so I did not know that I had to rename the file (it needs the php-extension), but after I corrected that error the page showed up as it should. There's only one (very minor) drawback: I could not test it on my local box. So after every change I need to upload the file to the server in order to check if the modifications are correct. Is it possible to install php on a single computer or is it typically server software? Regards, Egbert Zijlema

Share this post


Link to post
Share on other sites

Unfortunately it's not that easy! I've tried both, wampserver and xampplite as well, but I did not manage to get them running in the way it should. I'll keep trying with wampserver, but for the time being I can modify my website in the way I described above. That, after all, is the real important thing. Thanks for all your help.Egbert

Share this post


Link to post
Share on other sites

how is it not working? do the servers not start? are you putting your files in public/htdocs? are you making sure to view your pages over localhost://?

Share this post


Link to post
Share on other sites

Thank you, thescientist! Did not put my files in htdocs nor did I use "localhost" as part of the url. Tried to view the files by simply doubleclicking the filename in Explorer view; which is the way to load normal html-files in the browser.xampplite is doing the job now. However, installing this pseudo server software consumes a lot of disk space for a relatively tiny task. So I'm not sure whether I will keep it installed or not. Nevertheless lots of thanks to everybody who has contributed to this thread. Egbert Zijlema

Share this post


Link to post
Share on other sites
Thank you, thescientist! Did not put my files in htdocs nor did I use "localhost" as part of the url. Tried to view the files by simply doubleclicking the filename in Explorer view; which is the way to load normal html-files in the browser.
Well, that is the problem then. You need to read the instructions. In order to run server side code, it needs to be processed over the HTTP protocol, not just opening like a normal file. There is default folder for you to put all your projects in. Then you can run the Apache server and view your projects from within that context, that's how you simulate locally what is actually going on a webhost. If you plan on doing any server side scripting at all, running and developing your applications locally is pretty much a necessity.

Share this post


Link to post
Share on other sites

Thanks for your wise final thoughts. It was running now as expected. I needed it while porting an entire html-site to php. Now this job is finished and given the fact that there will be only one modifcation per month in the navigation section, which I can test online, I do not need it anymore. So, I uninstalled it. A running Apache-server on my local box sounds too vulnerable for me.

Share this post


Link to post
Share on other sites
A running Apache-server on my local box sounds too vulnerable for me.
?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...