Greetings all... again... ;) I'm familiar with some concepts from object oriented programming. In particular something which i think is called encapsulation.
In languages like C++ you build classes which are portable mini programs that do stuff. You can pick them up and plug them into any C++ program, you don't have to know how it works, you just know what it does and its input and output and you can just use it without any fuss. I'm looking at how HTML and CSS work, and wondering if there's some way to do similar things like this in web development. I understand javascript and php are both object oriented languages, but I'm just talking about html and css. For example... with the help of Vince (ghodmode) and a couple of others on this list I have built a really nice simple list layout. (see: http://www.davidthorp.name/testingstuff/ghodmode-a.html). Say I know want now to pick that list up and put it somewhere in the middle of another larger page (something with a lot more stuff in it, say http://www.davidthorp.name/testingstuff/browser-0c.html). Or more accurately, I want to pick that list up and put different versions of it (ie. same layout but perhaps different numbers of columns, different alignments in each column, etc) into various locations in a more complex layout. Ideally I want to keep that list in it's own file and just refer to it from the main file. I don't want to have to copy and paste the code from the list file into the main file. If this was C++, that would be relatively simple. The class would have methods that you can call with different parameters for different situations (eg. number of columns, alignment in each column, whatever). You then add a #include statement at the beginning of your main file, that effectively makes the class part of your program, and you call it from the main file with method calls and parameters, in each different situation. So... my question is... Is this possible in web development at all? Is it possible just with plain HTML and CSS files? If not, is this where I need PHP? Can I achieve the above with PHP? And if the answer to that is no, then is there any way to achieve this concept at all? Or am I just barking up the wrong tree here? Thanks! David. PS. for what it's worth the data in the records/rows in the list are ultimately going to be generated dynamically by PHP or other calls to a database, so the above question is only really about the table, the divs, and the css styling, not the data in the list. Hope that makes sense. ______________________________________________________________________ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/