User Name
Password
AppleNova Forums » Programmer's Nook »

HTML question...


Register Members List Calendar Search FAQ Posting Guidelines
HTML question...
Thread Tools
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2004-05-20, 21:13

Hello everyone,

As some of you might know, I have been working on a personal website for some time now. It looks good so far... a little lack of content but I'm filling it slowly.

Anyhow... I have a question...

The menu layout is the same in every page. . . There currently is eight pages in the site and another four in the works. . .
If I adjust the menu, I have to copy and paste the Changes to each html file of my site... this is annoying because I am always adjusting the menu.

Is there anyway for the HTML to call another HTML file for part of the page without using frames?

The menu is left justified via tables and consists of an image map and image.

So is there anyway of doing this so if I would like to make a change I only have to do it once and it effects the whole site?


EDIT: Oh yah, I am doing this all by hand... no fancy/easy-to-use program, just little old me editing text files. Once again, don't even note frames, I hate them. (so ugly)

no sig, how's that for being a rebel!
  quote
SledgeHammer
Senior Member
 
Join Date: May 2004
 
2004-05-20, 21:29

I was going to tell you to use the library function in DW, but that obviously won't help if you're doing it by hand. It seems like there should be a way to do that, but I am not aware of one (besides frames, of course). Maybe there's a Javascript solution. I do not know.

OK, sorry, this post was pretty unhelpful.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2004-05-20, 21:41

If your server supports them, server side includes look like they're for you.

Or you could use php to generate your pages. That would be my way of doing it.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2004-05-20, 21:46

Ok for someone with zero PHP knowhow... how easy would that route be?
Would it require a full rewrite? or could I just use it along with HTML?
  quote
rick1138
New Member
 
Join Date: May 2004
 
2004-05-20, 21:47

There is no way to do that with only html, you will need javaScript or better, php. If you simply want to change a piece of code in a batch of files the best way to do it is to use BBEdit - it has a batch search and replace function - very easy to use and bug-free, at least in my experience.
  quote
torifile
Less than Stellar Member
 
Join Date: May 2004
Location: Durham, NC
Send a message via AIM to torifile  
2004-05-20, 22:58

Quote:
Originally Posted by \/\/ickes
Ok for someone with zero PHP knowhow... how easy would that route be?
Would it require a full rewrite? or could I just use it along with HTML?
Shit man, it's dead simple. If all your content is in one part of the html file, you can get away with changing very little. You may need to cut up your code a little if the stuff you want to include on every page is scattered throughout your html code but it shouldn't be too hard.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2004-05-20, 23:02

So where do I go from here?
  quote
rick1138
New Member
 
Join Date: May 2004
 
2004-05-20, 23:34

Download BBEdit lite, open it, choose Search -> Find. A dialogue will come up that has all the entries you need to do batch search and replace. This is the easiest way to do what you want.


BTW, make sure you try this out on a copy of your html files, just in case it gets screwy.
  quote
FFL
Fishhead Family Reunited
 
Join Date: May 2004
Location: Slightly Off Center
 
2004-05-20, 23:36

Quote:
Originally Posted by rick1138
If you simply want to change a piece of code in a batch of files the best way to do it is to use BBEdit - it has a batch search and replace function - very easy to use and bug-free, at least in my experience.
Definitely the method I'd recommend, and by far the easiest and least complex. If you're handcoding HTML, you'll want to be using BBEdit anyway.
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2004-05-20, 23:37

Quote:
Originally Posted by rick1138
Download BBEdit lite, open it, choose Search -> Find. A dialogue will come up that has all the entries you need to do batch search and replace. This is the easiest way to do what you want.


BTW, make sure you try this out on a copy of your html files, just in case it gets screwy.
I was refering to the PHP thing torifile was talking about.

And on a side note, I can't use BBEdit... I'm doing the work on a x86 Linux box.

no sig, how's that for being a rebel!
  quote
rick1138
New Member
 
Join Date: May 2004
 
2004-05-20, 23:39

BTW again, php is a very cool language, worth learning but I think it would be overkill for this purpose.
  quote
rick1138
New Member
 
Join Date: May 2004
 
2004-05-20, 23:41

If you are on Linux the best solution would be to look for an app or a module that does search and replace, or else use PERL.
  quote
kretara
Cynical Old Bastard
 
Join Date: May 2004
Location: The Hot, Hazey, Humid South
Send a message via AIM to kretara Send a message via Yahoo to kretara  
2004-05-21, 08:57

Doesn't this belong in a "Programming" forum (j/k)

You really have 3 options.
1. enable server side includes (.shtml) in apache and put your menu in a file and call the file from each page
2. install PHP (if you need help let us know) and make a php include file, then call that file on each page.
3. useing Perl to search and replace. This will work for now but will get very cumbersome as the site grows.


IMHO, the PHP route is the best. It provides you more flexability in the long run plus you can add a database very easially. PHP is fairly easy to install, php.net has some great tutorials and I am also fairly familiar with installing both PHP and apache.

If you want some examples on how to make a PHP include file or of PHP code just PM me.

Last edited by kretara : 2004-05-21 at 08:59. Reason: spelling...whats that?
  quote
Wickers
is not a kind of basket
 
Join Date: May 2004
 
2004-05-21, 09:03

Quote:
Originally Posted by kretara
Doesn't this belong in a "Programming" forum (j/k)
No, it does not. Because HTML is scripting not programming.




And thanks for all the suggestions!

I am going to take a look at PHP... but might endup doing the work the hard way.

no sig, how's that for being a rebel!
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2004-05-21, 12:17

Information on PHP.net about include()

It's amazingly easy.

I'd suggest this PHP module (if your running it on your computer).

PHP is an awesome langauage and while I have a lot to learn (check genius bar or ask silent echos ) it is relatively easy and very powerful.

To have the same code show up on everypage simple add this to your html (php must be installed on the server):

<?php
include('dir/to/file');
?>

I'm pretty sure that is how you do it. Your web page probably has to end in .php instead of html or whatever, it won't effect anything though.

You just put the repeating code in that file and then it will be placed wherever you have the include().

I'm sure someone will come tell me I'm wrong but I tried

If you want to learn PHP without buying a book there isn't a place better then php.net
  quote
kretara
Cynical Old Bastard
 
Join Date: May 2004
Location: The Hot, Hazey, Humid South
Send a message via AIM to kretara Send a message via Yahoo to kretara  
2004-05-21, 13:07

Quote:
Originally Posted by ast3r3x
To have the same code show up on everypage simple add this to your html (php must be installed on the server):

<?php
include('dir/to/file');
?>

I'm pretty sure that is how you do it. Your web page probably has to end in .php instead of html or whatever, it won't effect anything though.

You just put the repeating code in that file and then it will be placed wherever you have the include().

I'm sure someone will come tell me I'm wrong but I tried

If you want to learn PHP without buying a book there isn't a place better then php.net
If you want you can set php to parse .html pages to mask your use of php. Here is another example of a php include:

<?php>
include_once "left_nav.php";
<?>

You can make a file called left_nav.php and place it in a directory somewhere (in the apache htdocs tree), I suggest in the "folder" where your .html/.php files will be server from. left_nav.php will contain any text/html/php that you want.
include_once means what it says, only include this file once even if called more than once.

BTW: you can also nest includes, ie. have an include file call another include file.

Good Luck!

Last edited by kretara : 2004-05-21 at 13:09. Reason: forgot to add link to include_once
  quote
kscherer
Which way is up?
 
Join Date: Aug 2004
Location: Boyzeee
 
2019-07-29, 22:46

If you place the css tag on the frame object, then the button manger should re-render the entire <.gif>. Try it out. If it doesn't work, though, you're probably doing it wrong.

Hope this helps.

- K

- AppleNova is the best Mac-users forum on the internet. We are smart, educated, capable, and helpful. We are also loaded with smart-alecks! :)
- Blessed are the peacemakers, for they shall be called sons of God. (Mat 5:9)
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools

« Previous Thread | Next Thread »

All times are GMT -5. The time now is 11:32.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova