Click to See Complete Forum and Search --> : For all that's holy... HELP!


Nightlord
08-03-2007, 10:11 PM
Ok, I've switched to .CSS and using DIVS. What I'm going with is a Header and two columns. The Header will have a static (non-changing) horizontal menu. I need to have each menu option change the menu that appears in the left column.
Then, each menu option in the left column will change what appears in the right column.

Check out my flash site to see what should happen: http://www.nightlord.com

For the life of me, I can't figure out how to get it to work in .CSS.

ImaNihilist
08-04-2007, 02:20 AM
You can't actually do that with pure CSS, at least not the way you are describing it. CSS alone will not let you reload a single div. To do that you are going to need either PHP & XMLHttpRequest or something similar. With only pure CSS you you have to reload the page every time even if you only want new content to appear in a single div.

Nightlord
08-04-2007, 11:41 AM
This makes me very sad. :(
So why the hell do people hate frames?

kpxgq
08-04-2007, 04:05 PM
AJAX ftw

ImaNihilist
08-04-2007, 06:25 PM
This makes me very sad. :(
So why the hell do people hate frames?
Frames died years ago. Why really isn't terribly important, but IIRC frames have been completely deprecated in XHTML. I think they were even deprecated in previous versions of HTML.

Now, you can do this kind of thing with AJAX controls, but that can get a little messy if you have no idea how to work with JavaScript.

I'd actually recommend simple PHP for this kind of thing. You can figure it out in just a few hours, assuming you have a server with PHP 4 or later (earlier versions will probably work too, but you might not be able to find a good tutorial).

Basically, with something like PHP you can create "frames" as separate PHP files, then you create a master file that includes the other content files. You kind of mash it up just like you would with frames. Every time you click, the entire page does have to refresh, but the server will create the new page quickly and dynamically. So if you want to change the header, you just change the header file and all the other files that use that are updated, so to speak, automatically. Larry Ullman has a book called PHP and PHP & MySQL that's published by Peachpit Press. IIRC, the book walks you how to dynamically create pages with PHP in like the first 50 pages. It should be enough to help you figure out how to do what it is you want to do. Probably find a really easy walk through on the interwebs too.

Truth be told though, for columns you are better off making use of XMLHttpRequest, but you are probably going to have to pick up a book on JavaScript.

ImaNihilist
08-04-2007, 06:26 PM
Also, you might just be able to rip something someone else used. I'd have a look around cssplay.co.uk

eshbach
08-05-2007, 05:26 PM
How much content are we talking about? Is it worth going back to the server to get it? If it's not dynamic content, I don't think you need to do an asynchronous request to get it, you can just put it all on the page and then swap it with a client-side script.

If you have a lot of content (or the content needs to be dynamic), then you'll need to do a very simple AJAX request (just a GET of the new content) and then replace the inner html of the div.

Either way you're looking at less than 20 lines of javascript and none of it will be anything fancy.

ImaNihilist
08-05-2007, 11:54 PM
How much content are we talking about? Is it worth going back to the server to get it? If it's not dynamic content, I don't think you need to do an asynchronous request to get it, you can just put it all on the page and then swap it with a client-side script.

If you have a lot of content (or the content needs to be dynamic), then you'll need to do a very simple AJAX request (just a GET of the new content) and then replace the inner html of the div.

Either way you're looking at less than 20 lines of javascript and none of it will be anything fancy.
For someone moving from simple HTML to what is perceived to be "complex" CSS, 20 lines of JScript is scary as hell! :p

JPnyc
08-06-2007, 05:45 PM
You can use an inline frame for this.

eshbach
08-06-2007, 05:49 PM
You can use an inline frame for this.

You could, but it's not in the XHTML standard and would be considered bad practice.

richardginn
08-06-2007, 06:07 PM
AJAX ftw


If it is a small amount of content go that way.