Perhaps the confusion comes from the word "class". A class is just a
name that tells the browser, "When you render this item, use these
settings." Outside of that, a class doesn't do anything like what an
object in OOP does. A class doesn't know how to render itself it. A
class doesn't respond to any messages, contain any functions, or return
any results. The browser interprets the CSS and might process any MS
filters (Javascript) found in the class definition.
On 03/09/2012 08:30 AM, Paceaux wrote:
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.
--
David
gn...@hawaii.rr.com
authenticity, honesty, community
______________________________________________________________________
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/