943,815 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Oct 18th, 2008
0

Banners, Headers, & Titles of website: How to share it among all the pages?

Expand Post »
Hi,

I'm creating a website and I've ended up with about 10 pages. Each page has the websites name and something like a banner/header. I've entered the banner/header for each page. So if I decide to make any changes, I'll have to change all 10! Is there anyother way that I can do this? Maybe by creating it separately and entering it in the page through a link or something...?? I'm quite new ...

I would appreciate if anyone could help me out on this,

Thanks,
Sonya
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sonya2525 is offline Offline
19 posts
since Jul 2006
Oct 18th, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

Hi Sonya,

Most hosting providers allow quick access to server-side scripting in PHP.

For example, you follow the tutorial for beginning PHP at w3schools.com.

You write a php file that contains functions that place your hearder / banner / title; then you include that php file into the individual 10 or so pages, and call the proper function (one time); then you've only got to tinker with the first script when things change.

site.php
HTML and CSS Syntax (Toggle Plain Text)
  1. function set_home_page_title($string) {
  2. echo $string;
  3. }
  4. function set_page_banner($int) {
  5. if($int == 1)
  6. echo '<img alt="" src="my_banner.jpg" />';
  7. else if($int == 2)
  8. echo '<img alt="" src="my_other_banner.jpg" />';
  9. else
  10. echo '&nbsp;'
  11. }
index.php (home page)
<title><?php set_home_page_title("Welcome to my site!"); ?></title>

about.php
<div class="banner"><?php set_page_banner(2); ?></div>

As you progress in web design, it becomes necessary to learn a few of these tools.
Reputation Points: 12
Solved Threads: 1
Junior Poster
tefflox is offline Offline
174 posts
since Jul 2006
Oct 18th, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

ok let me make it even easier for u. just design a page which only contains ur banner and that welcome note or wht ever u want. save it as a .php file. then in all ur page include that file at the header space. like this: <?php Include("header.php") ?>
header means ur page name ok and after tht whever u need to make a change just change it in the header.php or whtever u name it file. it will be changed every where . cheers.
Last edited by wickedsunny; Oct 18th, 2008 at 2:47 pm.
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008
Oct 18th, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

If you don't have scripting abilities you may consider an external Javascript file. Take this example:
header.js:
JavaScript Syntax (Toggle Plain Text)
  1. function header()
  2. {
  3. document.write("MySite <a href='index.html'>Home</a> <a href='about.html'>About</a> etc. "); //Put the header code here
  4. //Note when placing the header code, make sure you replace " (Double Quotes) with /" (Slash and then Double Quote). Ex. /"I have a dream/"
  5. }

For the pages you want the header:
Simply put this between the <head> and </head> tags:
JavaScript Syntax (Toggle Plain Text)
  1. <script type='text/javascript' src='header.js'></script>
And place this where you want the header:
JavaScript Syntax (Toggle Plain Text)
  1. <script type='text/javascript'>
  2. header();
  3. </script>
I would reccomend the PHP, since it is server side (and not executed on the client's browser) if possible. Here's an example:
header.php (Place your header's code in here):
HTML Syntax (Toggle Plain Text)
  1. MySite <a href='index.html'>Home</a> <a href='about.html'>About</a> etc. <!-- This is just a sample. Replace this line with your code -->
For a page that you want to put the header simply type:
PHP Syntax (Toggle Plain Text)
  1. <?php include('header.php'); ?>
Just make sure PHP is enabled.
Best of Luck,
FlashCreations
Last edited by FlashCreations; Oct 18th, 2008 at 7:41 pm.
Reputation Points: 47
Solved Threads: 47
Posting Whiz
FlashCreations is offline Offline
393 posts
since Sep 2008
Oct 22nd, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

Hi,


according to me best solution for is placing an image using class of id in css.

code is
{
background-image:path of image;
background-position: according to your requirement;
background-repeat:depend on your image;
}

after modifying this code i hope you will not face this problem in future

Thanks
Reputation Points: 11
Solved Threads: 0
Newbie Poster
shruti sepra is offline Offline
19 posts
since May 2008
Oct 22nd, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

Hi Shruti Sepra,

That is a good idea, but the thing is I have expandable drop down menus, can I still do that?!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sonya2525 is offline Offline
19 posts
since Jul 2006
Oct 23rd, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

<code><title>Home</title> </head><frameset rows="125,*"><frame name="banner" scrolling="no" noresize target="contents" src="Top.html"><frameset cols="170,*"><frame name="contents" target="main" src="links.html"><frame name="main" src="Sprot.html" marginwidth="10" marginheight="14" scrolling="auto"></frameset> </code>

Why not take the easy way out , i know it's not perfect scripting option but use frames in your index page to place your banner and menus in and let the other pages appear in the main-frame
Zr7
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Zr7 is offline Offline
2 posts
since Oct 2008
Oct 23rd, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

Frames.
Moderator
Featured Poster
Reputation Points: 1764
Solved Threads: 574
Moderator
jbennet is online now Online
16,509 posts
since Apr 2005
Oct 23rd, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

I did think of frames, but I've heard that they're not recommended...and when the user scrolls down, it's still on the page, and sometimes it's annoying if it takes up one third of the page.. but I guess if I cant' figure out how to do it with the answers given above, I'll just have to go with the frame or just copying and pasting and doing a lot of checking to make sure everything's working.....(sigh..)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sonya2525 is offline Offline
19 posts
since Jul 2006
Oct 24th, 2008
0

Re: Banners, Headers, & Titles of website: How to share it among all the pages?

Hi
Sonya2525,

use the css style if change in your css class then it will change in all your pages
Reputation Points: 10
Solved Threads: 3
Light Poster
siriyal is offline Offline
25 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Need help with tables
Next Thread in HTML and CSS Forum Timeline: Alt Labels on text





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC