Hi David, Though I am not a very good programmer, I am somewhat familiar with object-oriented programming languages and methodologies.
So I don't know how accurately I can answer the question, but I can tell you that I certainly believe it is possible to write HTML and CSS in an object-oriented approach (based on my understanding of object-oriented). My employer specializes in CMS implementations where object-oriented front-end code has significant benefits in large, enterprise web content management systems. In fact, the company for which I work is adopting my object-oriented methodologies for one of our clients. I can't give you a short answer to the methodology I've adopted, but I wrote a blog post a while back on the layers of design - which is the foundation for my approach. http://blog.frankmtaylor.com/2011/11/03/the-layers-of-design/ feel free to poke holes in that theory. </email> <signature id="paceaux"> Frank M Taylor http://frankmtaylor.com @paceaux </signature> On Mar 9, 2012, at 3:17 AM, David Thorp wrote: > 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/ ______________________________________________________________________ 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/