|
Search
|
||||||
javascript codingHTML & Coding HTML, XHTML, CSS, XML and other coding issues you may code into. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
javascript coding
I'm having a bit of trouble with javascipt at the moment.
What Id like to do is have a .js file that calls an image with a hyperlink, a google adsense banner, then another hyperlinked image. eg - IMAGE/GOOGLE BANNER/IMAGE you can see what I want on my website = www.filmsbynick.com/portfolio at the bottom of the page, I have an image linked to another site, a small silly little message which will be replaced with a google ad banner, and then another image. (dont say it, I know the images are for different things, but its all linked to one url, I know, i just messed up the coding, thats all okay?...back to topic now...) The reason I want to do this is so I can steamline my site, and update the header/footers of my web pages from one file, and I'm utterly hopeless at this type of thing, I've tried looking around for javascript tuts, but none seem to do what I want them to do If someone could whip up the code I need, and point to where I need to change filenames etc... that would be great. Thanks dudes
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile Last edited by Nickweb; Aug 22nd, 07 at 3:12 PM. |
| Advertisement |
|
#2
|
||||
|
||||
|
Ok, theres gotta be SOMEONE here who knows even basic Javascript, I've been looking over the net for some basics, but I havent really had the time for this. I have found how to call another js file from inside the main js file.
Can someone please give me some code that will hyperlink a image in javascript? I know how to do it in html, but it needs to be in java so I can have the whole thing in one js file Please
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile |
|
#3
|
||||
|
||||
|
Really you should do this in a programming language-not javascript.
I would probably do it in php like so: Code:
<?
include("header.html");
include("content.html");
include("footer.html");
?>
|
|
#4
|
||||
|
||||
|
Quote:
I know didly squat about php, could I have the footer of my page call the footer.php file, which in turn calls an image which is hyperlinked, the google ad js code, and then another hyperlinked image? very sorry if I'm not explaing this very well, and thanks for being patient, Feris
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile |
|
#5
|
||||
|
||||
|
Ok in the footer.html file you include the javascript for the Google ads (which Google provided you) and the HTML for your linked image. I don't understand why you're trying to do the hyperlinked image in javascript-is it for a roll over image? Or something else?
|
|
#6
|
||||
|
||||
|
ok, I see your point, I just had the idea for javascript as the google ad is javascript, but I see your point.
Now, none of my pages use php apart from the feedback form, its all html based. how do I use the above code, and do I insert it where I need the footer? thanks again
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile |
|
#7
|
||||
|
||||
|
You make a file called index.php and copy the code I gave you. Thats it.
You then put your header HTML into a file called header.html, and your main content into a file called content.html and then your footer stuff into footer.html. When someone vists your website, that code above pulls those three files together and presents it to the browser as a single page. |
|
#8
|
||||
|
||||
|
Thanks for the help Feris, I'll give it a shot right now
Edit: ok, I did as you said, put the above code in a index.php file, and made the header, content, and footer.html files. you can see the result here: http://www.files.filmsbynick.com/php/ now the thing is, I made my whole site in html, and I dont really want to have to re-make the whole thing in php, also, there seems to be no definitive break between the html files when pulled up by the index.php file. Is there a way to keep my html files at www.filmsbynick.com/beta/slick but have a php file at the bottom that will pull just the footer, and if so, how do I call the php file, and put it inside the html file? Incase my description above is as clear as mud, I've made a small visual aid below: ------------------------------------- filmsbynick (header) ------------------------------------- content here blah blah blah blah ------------------------------------- footer section (maybe call php file here, and only here)
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile Last edited by Nickweb; Sep 25th, 07 at 11:25 AM. |
|
#9
|
||||
|
||||
|
You have to rename the html files to php and then append at the bottom of the file
Code:
<?
include("footer.html");
?>
|
|
#10
|
||||
|
||||
|
Ok, I did what you said. At first I wasnt too sure about just changing the file extension from htm to php, but I did some googling, and you were right, all hail Fenis!
You can see the finished result on this page: http://www.filmsbynick.com/beta/slic...ographyphp.php I havent rolled this out across the whole site yet, but I will be doing so in the next few days once again, thanks, fenis, the footer inclusion will help me to keep my footer easy to maintain Edit #3 - Fenis, I freaking LOVE you for the php code snippets, I've now been able to 'include' my drop-down nav bar thing from a single file, so when I update my site, I wont have to go through every single page. I owe you many, many thanks indeed! ![]() oh, and I've finished updating the site, all images fixed, all working, I bow down to you for your help
__________________
My Blog www.filmsbynick.com http://www.youtube.com/filmsbynick For my comp specs, check out my profile Last edited by Nickweb; Sep 26th, 07 at 2:11 PM. |
![]() |
| Tags |
| coding, javascript |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Website coding help | Dave601 | HTML & Coding | 7 | Aug 26th, 05 3:36 AM |
| Javascript Dilemma | D Schrute | HTML & Coding | 1 | Apr 19th, 05 1:17 AM |
| XHTML Coding | jonesjc | HTML & Coding | 16 | Sep 27th, 04 9:20 PM |
| Javascript Problems PLEASE HELP | joebel | Internet | 7 | May 2nd, 03 12:48 AM |