|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Changing one word in a html file..
Hi
I was working a website for someone, and now i've found that all I need to do to change the web page is to change a link in my html code. What i've done it like so: Code:
<div id="innercontent"> <script language="javascript" type="text/javascript" src="about.txt"></script> </div> and that "about.txt" loads in the needed code, and is all I need to change when a user clicks on a link. Is this possible to make this change dynamically? Maybe with a small external calculation file? maybe using javascript, asp, html, css, php? Anything really. In pseudo code, what I need to do is: Code:
(when user clicks on link): 'link'.txt simple as that really. Maybe the calculation can be done in an external php file or something? I only know basic javascript, and html and css, so I don't really know if it's possible to do another way. Anything will do, just so long as it's easier than making an exact html page with simply that word changed for each link. Many thanks, -Luke |
|
#2
|
|||
|
|||
|
php include?
ive used that on my site for the links internal and external
__________________
Free Forum hosting for clans |
|
#3
|
|||
|
|||
|
Quote:
Thanks for the reply. Can you possibly offer a way of how I might implement the code? Can I put php code inside the html file, in a similar way to javascript? Thanks, -Luke |
|
#4
|
|||
|
|||
|
<?php include('page.php'); ?>
type that where you want the include file your page also needs to be php ie saved as php with <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?> at the very top of the page and your page.php should look like this <?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> text to be displayed here </body> </html> |
|
#5
|
|||
|
|||
|
Brilliant, thanks mate!
But I still have a couple more queries... So firstly, i'm right in thinking i've changed my index page to php now, right? And it's got html and php code inside? OK, so is it possible to link to a certain external page depending on what link a user clicks on? For example: "if user clicks on home button then the external text file to load in is 'home.txt'." Could you possibly offer a minute or two to give me a simple method of doing this? I'd be extremely grateful. My best assumption would be to use a variable, and whichever link the user clicks on is what the variable changes to, then I simple put "variable.text" to load in. I already know how to load in, so it's simply a matter of the part for reading what the user clicks on, and making that a variable. Thanks a lot, -Luke |
|
#6
|
|||
|
|||
|
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <a href="http://www.website.com/home.txt">text here</a> </body> </html> have that as the file that will be in the include tag |
![]() |
| Viewing: Dev Shed Forums > Web Design > Web Design Help > Changing one word in a html file.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|