Jump to content


Photo

How do i : Embed a .html into another .html page


  • Please log in to reply
10 replies to this topic

#1 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 06 November 2007 - 06:50 PM

Ok, here's my issue.
I'd like to embed a html into another html.

In detail, i have 3 pages, and 1 page with the "navigation bar".
I'd like to embed the navigation bar page into each of the other pages so that i don't have to copy paste the navigation bar into each of the other pages anytime i make a change to it.

Now, frames would obviously be an option, but i think that's a bit outdated and ugly.
the <object> tag seems to have the option to do what i need,, but i'm not sure if its fully compatible with all browsers i use (firefox, safari, ie7).
Perhaps there's a more widely accepted option to do this with?

Hopefully someone can give me an insight in this.

#2 jlhaslip

jlhaslip

    Devoted Member

  • Members
  • PipPipPipPipPip
  • 2,568 posts
  • Gender:Male
  • Location:South Eastern BC, in the Rockies
  • Languages:(x)html, css, (some) php, nothing tricky...

Posted 06 November 2007 - 06:54 PM

A server side language such as php or asp can do that for you.

Have a look at the w3schools tutorials about that topic.

Your Hosting service *may* have the php or asp software for you to use, but *some* Hosts do not allow it. Check with your Service provider.

#3 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 06 November 2007 - 07:05 PM

A server side language such as php or asp can do that for you.

Have a look at the w3schools tutorials about that topic.

Your Hosting service *may* have the php or asp software for you to use, but *some* Hosts do not allow it. Check with your Service provider.


Cheers for the quick reply, i'll give a poke to one of the admins.
Hopefully it's possible.

#4 jlhaslip

jlhaslip

    Devoted Member

  • Members
  • PipPipPipPipPip
  • 2,568 posts
  • Gender:Male
  • Location:South Eastern BC, in the Rockies
  • Languages:(x)html, css, (some) php, nothing tricky...

Posted 06 November 2007 - 07:32 PM

One method to check to see if you are able to run php is to cut and paste the following code into a file named test_for_php.php, upload it to your Host and then use you browser to navigate to the page on your Hosting account.
(http://www.yourdomai...est_for_php.php)
Change the yourdomain value. of course.

It replies with an error if you are not able to use php and gives you a whole bunch of info about the php configuration if it is enabled on your account.
<?php
$inis = ini_get_all&#40;&#41;;
echo &#39;<pre><br />&#39;;
print_r&#40;$inis&#41;;
echo &#39;</pre><br />&#39;;
?>
Or a simple phpinfo() would work, too.
<?php
phpinfo&#40;&#41;;
?>
Same thing, upload it as a php file and navigate to it using your browser.

#5 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 06 November 2007 - 09:05 PM

One method to check to see if you are able to run php is to cut and paste the following code into a file named test_for_php.php, upload it to your Host and then use you browser to navigate to the page on your Hosting account.
(http://www.yourdomai...est_for_php.php)
Change the yourdomain value. of course.


Shame, but seems i can't upload php files to begin with.

The file extension: php is not supported


I guess i'll have to settle for a pure html solution for now, unless i can bribe an admin :)

#6 boen_robot

boen_robot

    XSLT senior

  • Moderator
  • PipPipPipPipPipPipPip
  • 8,486 posts
  • Gender:Male
  • Location:europe://Bulgaria/Plovdiv
  • Interests:Everything having to do with computers... and science.
  • Languages:(X)HTML, CSS, XML, XSLT, Schema, PHP, JavaScript (a little), other XML based...

Posted 06 November 2007 - 09:51 PM

Can you use XML and XSLT files? If so, you could use XML to store per-page data and transform each one with a single XSLT file containing the common data. Read on the XML and XSLT tutorials and test if this is allowed on the server.
The greatest difficulty in programming is not in finding answers, but in asking yourself the right questions. -- If nobody has said it before, then I'd like to take credit of thinking this up (during summer of 2010).
"Complex problems often have the simplest solutions" -- Not sure who said that first.
=== My projects (all feedback welcomed) ===
XML_XSLT2Processor(0.5.3) - perform XSLT 2.0 transformations in PHP.
PEAR2_Net_Transmitter(1.0.0a4) - reliable sockets.
PEAR2_Cache_SHM(0.1.2) - persistent data storage wrapper.
=== Useful tools ===
NetBeans - full featured PHP IDE, as well as a decent code editor for other things.
Fiddler2 - The best free HTTP debugger. Performance tuning, security check, integrity check, custom requests and more, all made easy.
Gobby - That's NOT my Nickname! Look at the topic.

#7 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 06 November 2007 - 09:55 PM

Can you use XML and XSLT files? If so, you could use XML to store per-page data and transform each one with a single XSLT file containing the common data. Read on the XML and XSLT tutorials and test if this is allowed on the server.


Seems i'm restricted to: css, html, gif, png, jpg
So no xml either.

I've mailed 2 of the admins, hopefully some more file formats will be allowed for upload soon.

#8 Synook

Synook

    53 79 6E 6F 6F 6B 0D 0A

  • Moderator
  • PipPipPipPipPipPipPip
  • 7,419 posts
  • Gender:Male
  • Location:Australia
  • Interests:Web development, Computer Science, and the pursuit of knowledge in general.
  • Languages:(X)(HT)ML, CSS, PHP, SQL, JavaScript, Java, Python

Posted 07 November 2007 - 08:54 AM

Is shtml or SSI allowed?

#9 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 07 November 2007 - 01:14 PM

The complete list of types i can upload is :
"Allowed Types: gif, jpg, jpeg, png, swf, html, css, txt"

So, even .js is currently unavailable unless i put it directly into the .html file.


Ah well.
This "seems" to work for now, not happy with it though. (its very slow, and doesn't seem to work properly in IE)
Some tweaking required still.

Edit: added div to center it in IE as well. Seems ok now.
<div id=&#34;nav&#34; align=&#34;center&#34;>
<object type=&#34;text/html&#34; data=&#34;linktest.html&#34; width=&#34;600&#34; height=&#34;40&#34; align=&#34;center&#34;>
<param name=&#34;BorderStyle&#34; value=&#34;1&#34; />
<param name=&#34;MousePointer&#34; value=&#34;0&#34; />
<param name=&#34;Enabled&#34; value=&#34;1&#34; />
</object>
</div>

If you wish to replicate this, make sure you put target="_parent" in any hrefs in the linked page object.

Edit2: doesn't work on windows.... ugh.

Edit3: ok blast.. i don't see any way to get it working.
on mac-safari it works perfectly.
on mac-ie5,6,7 whatever it works fine.
didnt try mac firefox, but i suspect itll work.
at home, on windows xp with ie7, all i see is a blank box.
i'm clueless...

#10 Synook

Synook

    53 79 6E 6F 6F 6B 0D 0A

  • Moderator
  • PipPipPipPipPipPipPip
  • 7,419 posts
  • Gender:Male
  • Location:Australia
  • Interests:Web development, Computer Science, and the pursuit of knowledge in general.
  • Languages:(X)(HT)ML, CSS, PHP, SQL, JavaScript, Java, Python

Posted 08 November 2007 - 12:53 AM

IE does not recognise the <object> tag, instead having the more limiting variation <embed> (which can't embed other HTML files, unfortunately, I don't think)

#11 bbr

bbr

    Newbie

  • Members
  • Pip
  • 32 posts

Posted 08 November 2007 - 07:50 AM

It must be windows specific then, as the object tag works fine on IE 5.2 on the mac.
Quite strange.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users