Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fixed Page Width and Centering


Guest

Recommended Posts

I've seen a lot of widely dispersed traffic on the issue of making one's site centered and of a standard width, generally 800px, and I think I've seen at least three fixes. However, the one I used is, so far, the easiest, and therefore, since I'm new, I must know why it is doomed to fail. :'( :)

 

I modified one file, catalogue/includes/header.php, inserting the code boxed below just after the first "?>" where the php reads

 

echo $messageStack->output('header');

}

?>

 

<html>
<table width="100%" border="0" cellspacing="5" cellpadding="5" bgcolor="black"> <tr> <td>

<center>
<table border="0" cellspacing="0" cellpadding="1" bgcolor="#11641f"><tr><td>

<table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="black"><tr><td>

 

Note the presence of a spare table, to make a green border, but you can just cut out the extraneous table. . . and then, at the bottom of the file, I inserted the following boxed code just prior to the close php tag.

 

//Closing tags for center/border attempt.
</td></tr></table>
</td></tr></table>
</center>
</td></tr></table>

</html>

 

Many of the other attempts suggest you have to do something like this to every php file in the catalogue directory, starting with catalogue/index.php, and others have used the ol' div command, which I speak of as though I had ever heard of it prior to two hours ago.

 

At first I just modified the index.php file as recommended by another poster, prior to modifying everything in catalogue, but then took it out and just modified header.php to see what would happen. It looks like it works, but since it is, in fact, just modifying header.php, and not the entire layout as some of the css fixes recommend, I'm wondering if it breaks down somewhere I'm not aware of.

 

Nonetheless, and pardon the excess description, it appears to work for me.

 

--David

Link to comment
Share on other sites

David - if you are using a stock shop, then you are doing it incorrectly. If you look in the index.php filem you will see that the files are included like this:

 

header.php

column_left.php

index code goes here

column_right.php

footer.php

 

This layout is the same for all of the files in your catalog diretory. So by putting all of your code into the header file, you are leaving out a lot of code. The correct way is to put the opening table code in the header files and the closing in the footer. There is no other way on a stock shop due to the layout used.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack--

 

Good point, and thank you. :thumbsup: I changed my code accordingly, so that the opening table information is where it was in header.php, and my closing table and html is in footer.php, just prior to the php closing.

 

I'm curious, though, as to why, when I had all the commands in header.php, the whole site was affected by the formatting. From what I think you're saying, just the top of the page should have been formatted, and the rest should have been the standard 100%/non-bordered, but when I checked it out in IE and Mozilla, the full content of every page as I navigated the site was limited to 800px, centered, and surrounded by the 1px psuedo-border.

 

1) Did I apply your fix properly? 2) Is this ithe proper way to make my site 800px/centered/bordered? 3) Why did my modification of just header.php format the whole page, and apply throughout the site?

 

Thanks again for your explanation. :)

 

David

 

PS: The site framework is pretty darn stock at the moment, although I'm working on the facelift. I wasn't planning to even touch the "How's my Site" forum for a couple weeks, but in case you can see something broken I missed:

Knight Vision Gaming

Link to comment
Share on other sites

Another option would be to control it via the stylesheet.

 

Roger that, but I'm still largely afraid of mysterious stylesheet "DIV" commands which require lengthy post explanations, so I found a cozy html solution to my problem. :-"

 

Besides, I'm having that weird stylesheet problem I've seen so much discussion on and no finalized answer to, wherein I make changes in the sheet and they aren't reflected on the page. Well, the weirdness is that my initial changes showed up, but when I changed them back to what they were, nothing happened. There are a number of suggestions, mostly related to browser history and such, but they don't seem to help.

 

For example, I changed the color of the nav bar below the header to black, and now no matter what I set it to, it's black, same for the text (except it's white), and dittos for the border around the infoboxes, which I made black and won't change back.

 

The stylesheet seems to be possessed, :blink: and I took out a restraining order.

 

--David

Link to comment
Share on other sites

Roger that, but I'm still largely afraid of mysterious stylesheet "DIV" commands which require lengthy post explanations, so I found a cozy html solution to my problem.  :-"

 

Besides, I'm having that weird stylesheet problem I've seen so much discussion on and no finalized answer to, wherein I make changes in the sheet and they aren't reflected on the page.  Well, the weirdness is that my initial changes showed up, but when I changed them back to what they were, nothing happened.  There are a number of suggestions, mostly related to browser history and such, but they don't seem to help.

 

For example, I changed the color of the nav bar below the header to black, and now no matter what I set it to, it's black, same for the text (except it's white), and dittos for the border around the infoboxes, which I made black and won't change back.

 

The stylesheet seems to be possessed,  :blink: and I took out a restraining order.

 

--David

Silly question, but are you editting the right file?

 

I have done this myself, (recently). Thought I was editting the file I wanted on my local server and found it was the one on my USB drive - doh!

 

It's the silly little thing that drive us up the wall.

 

Also with the css changes, it's only 1 file to change and not several!

Link to comment
Share on other sites

Silly question, but are you editting the right file?

 

I have done this myself, (recently).  Thought I was editting the file I wanted on my local server and found it was the one on my USB drive - doh!

 

It's the silly little thing that drive us up the wall.

 

Also with the css changes, it's only 1 file to change and not several!

 

John,

 

There are no silly questions with newbies! However, I am indeed editing the right file, as evidenced by the fact that other changes take effect. And, had the alteration to header.php and footer.php not worked, I would have attempted the css fix. As it is, I'm glad I didn't have to mess with the inexplicable willful and rebellious document. The style sheet is turning me into a curmudgeon. I'm really impressed with the things I've done and which have *worked,* though. However, I don't want to do anything else to the stylesheet which I might mysteriously be unable to undo.

 

--David

Link to comment
Share on other sites

Jack--

 

I'm curious, though, as to why, when I had all the commands in header.php, the whole site was affected by the formatting.  From what I think you're saying, just the top of the page should have been formatted, and the rest should have been the standard 100%/non-bordered, but when I checked it out in IE and Mozilla, the full content of every page as I navigated the site was limited to 800px, centered, and surrounded by the 1px psuedo-border.

 

1)  Did I apply your fix properly?  2)  Is this ithe proper way to make my site 800px/centered/bordered?  3)  Why did my modification of just header.php format the whole page, and apply throughout the site?

 

Thanks again for your explanation.  :)

 

David

 

PS:  The site framework is pretty darn stock at the moment, although I'm working on the facelift.  I wasn't planning to even touch the "How's my Site" forum for a couple weeks, but in case you can see something broken I missed:

Knight Vision Gaming

1 - Sounds like you did.

2 - It is A proper way. You can also use css.

3 - No idea. It should have dislalyed incorrectly.

 

I looked at your site. I think you need to do something with the colors. I can't make out some of the words because of the contrast and the ones that I can make out are hard to read.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

John,

 

There are no silly questions with newbies!  However, I am indeed editing the right file, as evidenced by the fact that other changes take effect.  And, had the alteration to header.php and footer.php not worked, I would have attempted the css fix.  As it is, I'm glad I didn't have to mess with the inexplicable willful and rebellious document.  The style sheet is turning me into a curmudgeon.  I'm really impressed with the things I've done and which have *worked,* though.  However, I don't want to do anything else to the stylesheet which I might mysteriously be unable to undo.

 

--David

The only silly question is the one that is not asked!

 

I have a great text editor called NoteTab and always leave the documents open in it for about 24 hours. In the event things go pear shaped, I can do a quick CTRL-Z through each doc and revert back to what it was.

 

I love the description of the stylesheet. I have felt like that on many occasions when trying to amend styles, but we do get there in the end.

Link to comment
Share on other sites

I had the same sort of problem on my computer at work which meant any minor changes I made weren't being reflected when I hit refresh.

 

I managed to overcome that though by doing a 'hard refresh'. By pressing ctrl + F5 the browser seemed to dump whatever it had in it's memory banks and reloaded the entire page with all changes made, unlike regular refreshing which seemed to only show up certain ones (major layout changes) and seemed to not notice the others - like new/different buttons and colour schemes and whatnot.

 

I don't know if it helps, but it worked for me with a similar issue.

Link to comment
Share on other sites

1 - Sounds like you did.

2 - It is A proper way.  You can also use css.

3 - No idea.  It should have dislalyed incorrectly.

 

I looked at your site.  I think you need to do something with the colors.  I can't make out some of the words because of the contrast and the ones that I can make out are hard to read.

 

Jack

 

Jack,

 

re: contrast--they look all right on my screen (heh, and to my highly subjective eyes), but obviously, mine isn't ultimately the important one. If I may ask, which words caused problems? The infobox headers, main text, or the title name? Those are the three types I'm using. I've had it suggested to me that the gray is too dark, so I'm lightening it up some for better contrast.

 

Thanks,

 

David

Link to comment
Share on other sites

The only silly question is the one that is not asked!

 

I have a great text editor called NoteTab and always leave the documents open in it for about 24 hours.  In the event things go pear shaped, I can do a quick CTRL-Z through each doc and revert back to what it was.

 

I love the description of the stylesheet.  I have felt like that on many occasions when trying to amend styles, but we do get there in the end.

 

John,

 

Thanks for the recommendation. I also discovered, much to my self-deprecating amusement :blush: :-" (I'm having trouble pointing and laughing at myself while simultaneously typing) that it's inappropriate to use "//" to comment things out, but rather requires "/*", and I was invalidating lines of code by adding incorrectly written comments, which is why my first change to the stylesheet would work, but subsequent changes wouldn't, after I marked the style sheet with my observations. >_<

 

Amazing. The adventures of observationally challenged newbies continues, unchecked.

 

--David

Link to comment
Share on other sites

Jack,

 

re:  contrast--they look all right on my screen (heh, and to my highly subjective eyes), but obviously, mine isn't ultimately the important one.  If I may ask, which words caused problems?  The infobox headers, main text, or the title name?  Those are the three types I'm using.  I've had it suggested to me that the gray is too dark, so I'm lightening it up some for better contrast.

 

Thanks,

 

David

The logo and the word that comes before "much like the US." Can't make them out without a lot of straining. But maybe that is just me.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The logo and the word that comes before "much like the US."  Can't make them out without a lot of straining.  But maybe that is just me.

 

Jack

 

No, I don't think it's just you--it definitely needs to be lightened. Thanks for pointing it out. :thumbsup: I've been trying to find the right sort of glowy green, and colors look quite different depending on their background.

 

As for the html fix for page centering/width, I haven't noticed any snags on the site, and seems to be a good early replacement for people more familiar with html than CSS. I'll probably implement the DIV command later, just to have the code all in one place, and neatly governed from the top, as per the magic of CSS.

 

--David

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...