473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

keeping the same content in a cell from page to page

NoPeasHear
I didn't know where to put this question, or how to even word it.

If I have a portion of my page that I want to load the same way on every page, how would I create a file that it would load and how would I link it to every page?

Please - examples - or a tutorial or something ... a bone?
Oct 14 '06 #1
3 897
ronverdonk
4,258 Expert 4TB
Usually you make a template of your site containg a fixed part and a 'variable' part. It contains, let's say for example, (1) the html headers, (2) the js and css includes, (3) the fixed header, (4) the fixed menu, (5) the fixed side bars and (6) the start of the variable part usually with a <div> construction.

Sometimes there is also a bottom template for date, copyright, etc. Each page of the site starts loading the template and fills the variable part dynamically. E.g.
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // This template contains alls the start HTML, the CSS, the JS, and all the other fixed parts.
  3. require_once('top_template.php');
  4. ?>
  5. // Here is the variable part within <div> ... </div>
  6. // Switching to HTML but can also be done using e.g. PHP
  7. <div class="xxxx">  where the xxxx class is defined in the previously loaded CSS definitions
  8. ..................................
  9. .... your variable part (code, images, html, ...) 
  10. ....................................
  11. </div>
  12. <?php
  13. // This template can contain some bottom line fixed parts, date, copyright, etc.
  14. require_once('bottom_template.php');
  15. ?>
  16.  
I am sorry to say that I don't know where to find tutorials on this topic. I have been using this construction for so long that I don't know how I learned it. Probably by trial and error.

Ronald :cool:
Oct 14 '06 #2
Have you tried using frames or php site.
Oct 16 '06 #3
Please spare us all and do not use frames. EVER! This particular component should be shunned and bannished to the land of Foobar for eternity. Like the top poster said, use templates to include your common code, and variables to control any variable data. See this example:
Using PHP Includes to Manage Common Components

Good luck!

Steve Hanson
Tasen Software
New Hampshire (NH) Website Design & Software Development
Oct 18 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Billy Jacobs | last post by:
I have the following script tag embedded in a table cell on a web page like so: <TD> <DIV> <SCRIPT src='http://voap.weather.com/weather/oap/70809?...
179
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
4
by: jake | last post by:
Maybe some kind person can help with a suggestion or two ;-) I want to construct a banner on a number of pages in the format: LHS: Text (variable content) RHS. Logo ..... each with a...
8
by: Timothy Casey | last post by:
Is there any way to code an external style sheet to ensure that all pages opening with a reference to that style sheet include generic content such as headers, logos, taglines, universal navigation...
31
by: Royal Denning | last post by:
I am designing a table with 2 columns and 20 rows. I want to insert small images (each with a link) and a text title in each cell of the table. On refresh of the page, I would like to have the...
0
by: Ramesh | last post by:
I am using a datalist control in my page and it has a header template. In the header template I have a table control with table rows and table cells. While the page is loading I am trying to change...
7
by: Tristán White | last post by:
Hi there, this'll be an easy one I'm sure. I have a small question that will take a second to answer, I am sure. If you go to http://snipurl.com/t821 All the buttons on the left are red, and...
5
by: Barkster | last post by:
How do I keep a content control from throwing off the size of my pages? When I drop a content control in my header it resizes the cell to a larger size and when I publish the page it is now sized...
0
by: news | last post by:
I'm trying to preview some HTML formatted text to show the context that a particular search result was found in. (does that make sense?) The idea is to take that HTML and display it as a stream...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.