HTML Help

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
I'm creating a blog like page and am having some design problems. I want to make a webpage inside of another web page trying to stay with only HTML or even Java. This way I can change the content on the fly on the inside page without having to mess with the code on the master page or possibly altering them accidentally. I would also go with an easier way to do this too if there is one available. Right now I'm just looking for ideas or opinions.


This is what I had in mind but it's not working with firefox for some reason.
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
It's on my home server and I don't have PHP installed yet. On top of that I know nothing of PHP except modding a few pages on PHPBB board which I had a walkthough to follow.
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
Originally posted by: LoKe
For what you want, the only HTML solution is an iFrame.


I googled and only found a bunch of web hosting companies talking aboutusing it and some features. Is there a website with the code and a few demonstrations or examples on it?
 
Jun 4, 2005
19,723
1
0
Originally posted by: bluestrobe
Originally posted by: LoKe
For what you want, the only HTML solution is an iFrame.


I googled and only found a bunch of web hosting companies talking aboutusing it and some features. Is there a website with the code and a few demonstrations or examples on it?

Basically you stick the iframe in your main page. While I haven't used an iFrame in a long time (bad practice IMO), I think I can explain to you how it's done. It's quite simple, like a table.

Contents of your index.html:
<html>
<head>
<title>Lol hi</title>
</head>
<body>
<iframe width="50%" height="50%" src="page2.html"></iframe>
</body>
</html>

Basically, you'll have a medium sized box in the middle of your index page, and in that box you'll see the contents of page2.html.
 

Rip the Jacker

Diamond Member
Dec 29, 2004
5,415
1
76
Originally posted by: bluestrobe
Why is iFrame bad practice?

Because the search engine can't see the iFrame. Not to mention it looks ugly.

Any dummy can use PHP include statements.. so if your server supports PHP just use

<?php include('file.html'); ?>
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
Originally posted by: Rip the Jacker
Originally posted by: bluestrobe
Why is iFrame bad practice?

Because the search engine can't see the iFrame. Not to mention it looks ugly.

Any dummy can use PHP include statements.. so if your server supports PHP just use

<?php include('file.html'); ?>


Wow, I like being called a "dummy". If you read the whole thread you would have seen I don't have PHP installed on this server. It's a future solution but right NOW it isn't.
 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
even without PHP, you can do server side includes (assuming you're running a webserver that has SSI) most common server setups have .shtml files parsed for SSI, but some servers parse html for em too

 

troytime

Golden Member
Jan 3, 2006
1,996
1
0
also, iframe will work, but the browser (client side) makes the http request

its bad for search engines, and bad for users if the web developer doesn't know how to set targets

both of those can be overcome if you read up on it
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Originally posted by: bluestrobe
Wow, I like being called a "dummy".
Jeez... chillax, man. He obviously wasn't trying to be insulting.
If you read the whole thread you would have seen I don't have PHP installed on this server.
So go install PHP, then. Yeah, you can do this with iFrames or server-side includes, just like you can drive in a nail with a screwdriver if you try hard enough. As Rip pointed out, it's literally a one-liner to what you're asking with PHP.


 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
I'll use iframe at the moment and use PHP when I feel the need to learn another language.

Also using Apache2.2. I don't have a SSI installed.
 

Soccer55

Golden Member
Jul 9, 2000
1,660
4
81
Originally posted by: bluestrobe
I'll use iframe at the moment and use PHP when I feel the need to learn another language.

In the OP, you said that you would go with an easier way to do this if there was one available. To be honest, every person suggesting that you use PHP is giving you an easier way to do it. You don't actually have to learn much PHP to get this to work.....you only need to know the line of code that Rip The Jacker wrote in his post. It really is very easy and since you said that you could install PHP on your server, I would definitely go with it as it will look better than an IFrame and likely save you some headaches as well.

-Tom
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
I'll look into the PHP solution here in a bit. This website doesn't go public until the 10th of next month anyways so I should have some time to play with the PHP code. The only tough part is I never played with PHP from scratch so it will be interesting.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
Originally posted by: bluestrobe
Is there a good website explaing PHP?
php.net has the whole language reference, and there are a zillion php howto's and recipes online. But for what you're doing, there's nothing to explain that hasn't already been stated in this thread. To say it again...

0) Install PHP using your distro's package manager. For most distros, apache will use it automatically. You don't need to touch anything in php.ini.

1) Put each chunk of HTML you want duplicated on every page in its own file. Let's say you have just one chunk, and you put it in common.html.

2) In the spot in your web pages where you want the common chunk, put the line:
<?php include('common.html'); ?>

3) Make sure your pages' file names end with .php so that apache knows to use PHP on it.

That's it. There are no tricks to it, and no "language" to learn. Of course, there are many other things you can do with PHP, but to solve the problem you posed in the OP, you just use the one line of code from #2.
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
Originally posted by: cleverhandle
Originally posted by: bluestrobe
Is there a good website explaing PHP?
php.net has the whole language reference, and there are a zillion php howto's and recipes online. But for what you're doing, there's nothing to explain that hasn't already been stated in this thread. To say it again...

0) Install PHP using your distro's package manager. For most distros, apache will use it automatically. You don't need to touch anything in php.ini.

1) Put each chunk of HTML you want duplicated on every page in its own file. Let's say you have just one chunk, and you put it in common.html.

2) In the spot in your web pages where you want the common chunk, put the line:
<?php include('common.html'); ?>

3) Make sure your pages' file names end with .php so that apache knows to use PHP on it.

That's it. There are no tricks to it, and no "language" to learn. Of course, there are many other things you can do with PHP, but to solve the problem you posed in the OP, you just use the one line of code from #2.


This thread was wonderful. I didn't want to have a PHP reference to do it "better" than those who have helped me here already. I wanted to reference because I was curious and wanted to learn more about PHP after I got done with this little project. Thank you for your post though. Also running Apache2.2 on a Win2K Server platform.
 

bluestrobe

Platinum Member
Aug 15, 2004
2,033
1
0
Looks like installing PHP on an Apache2 Win2K Server platform is a PITA but I only read a little bit of the installation txt. I'll continue tomorrow.

edited to change spelling errors.