Names, Names, Names
Moderator: General Moderators
Names, Names, Names
What would you call a class that contained methods that output some sort of html ( selects, pagination, links, tables )?
class html
class view
class components
ideas?
class html
class view
class components
ideas?
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Names, Names, Names
Depends...neophyte wrote:What would you call a class that contained methods that output some sort of html ( selects, pagination, links, tables )?
class html
class view
class components
ideas?
Is this class capable of outputting everything that HTML supports? If not, HTML is likely to vague...
View is also vague as it tells you nothing, other than it's purpose...
Components is to specific, unless your class is simply outputing SELECT with it's array of OPTION's???
Perhaps a compound name would make better sense...
Is it an article builder or form builder?
- CHtmlArticle
- CHtmlForm
Are two which come to mind
Re: Names, Names, Names
Well, I think I'd break it down into 4 classes: selects, pagination, links, tables; not 100% sure though.neophyte wrote:( selects, pagination, links, tables )
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
What is a table? It's made up of cells (of different types) organized into rows. But things are never just tables, usually, it's a list of database rows or an array of objects. In the latter case, we're clearly in the Model area.
So, if we want to transform that into html, we'd have to read the objects, get the fields in the object we want, format them in HTML, etc, etc, etc. But what if we transformed the array of objects into a Table composed of Rows composed of Cells? Then, the HTMLGenerator_Table takes these and turns them into HTML (or TextGenerator turns them into an ASCII table). This way, the code for generating tables (which can be pretty complicated), is generalized, so any list of objects can be transformed accordingly.
Actually, I don't really know. Whatever happened to templating?
So, if we want to transform that into html, we'd have to read the objects, get the fields in the object we want, format them in HTML, etc, etc, etc. But what if we transformed the array of objects into a Table composed of Rows composed of Cells? Then, the HTMLGenerator_Table takes these and turns them into HTML (or TextGenerator turns them into an ASCII table). This way, the code for generating tables (which can be pretty complicated), is generalized, so any list of objects can be transformed accordingly.
Actually, I don't really know. Whatever happened to templating?
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Sorry for letting you guys hang for so long.
The html methods are a series of "utilities" for that simple gallery thing of mine. In no way is it intended to be a total HTML solution or any major segment of it. It's just away of separating the view logic and html. Here's a list of method names. That'll give you an idea of what they do.
message
gallery_name
set_navigation (pagination)
next_image
previous_image
image_search
format_string
make_select
make_switch
bytes_to_kb
bread_crumb
set_footer
get_image_descrip
make_querystr (makes links)
I've got it penciled in as html right now. How bout html_utilities .... I dunno.
Suggestions?
The html methods are a series of "utilities" for that simple gallery thing of mine. In no way is it intended to be a total HTML solution or any major segment of it. It's just away of separating the view logic and html. Here's a list of method names. That'll give you an idea of what they do.
message
gallery_name
set_navigation (pagination)
next_image
previous_image
image_search
format_string
make_select
make_switch
bytes_to_kb
bread_crumb
set_footer
get_image_descrip
make_querystr (makes links)
I've got it penciled in as html right now. How bout html_utilities .... I dunno.
Suggestions?
Meaning classes can only participate in the Model portion of your application?alvinphp wrote:I agree with Ambush Commander in that I would call the class html_generator though I personally don't like classes creating html as that should be seperated from your model. (unless I am misunderstanding what you are trying to do)
I went with html_generator. I think it will suffice for my simple application.
Here's the general map in brief:
gg_init: initializes objects and calls the correct module class
gg_modulename_module: contains the view logic. Makes calls to file_data class and sends data to the html_generator methods
gg_html_generator: Takes the data makes the html and sends the output to gg_view
gg_view: Then outputs the view directly or returns the output in a variable.
What do you think?
Here's the general map in brief:
gg_init: initializes objects and calls the correct module class
gg_modulename_module: contains the view logic. Makes calls to file_data class and sends data to the html_generator methods
gg_html_generator: Takes the data makes the html and sends the output to gg_view
gg_view: Then outputs the view directly or returns the output in a variable.
What do you think?
For me the Classes is my Model. If the html was in your database though then my classes would be dealing with html in that it needs to grab the html from the database and then pass it to my controller.sweatje wrote:Meaning classes can only participate in the Model portion of your application?alvinphp wrote:I agree with Ambush Commander in that I would call the class html_generator though I personally don't like classes creating html as that should be seperated from your model. (unless I am misunderstanding what you are trying to do)
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
That is a strange list. It seems to have everything from helper functions like bytes_to_kb to library classes like a pagination to View stuff like gallery_name. What do you see as the orginazation of these things?neophyte wrote: message
gallery_name
set_navigation (pagination)
next_image
previous_image
image_search
format_string
make_select
make_switch
bytes_to_kb
bread_crumb
set_footer
get_image_descrip
make_querystr (makes links)
(#10850)
Your right aborint it is a strange Franksteinish list of methods. Most of these are helpers of some sort or other. But most of them create/return a string with HTML tags. Should I further segment them? I'm not sure. That's been the problem with this app for sooooo long -- that is how should rolls be divided. So here they are again with some brief explanation. I've indicated on a few that they should be moved.
message -- returns a string with paragraph tags for some information to the user
gallery_name -- returns a the title of the gallery with h2 tags
set_navigation (pagination) -- creates pagination (html links)
next_image returns a link to the next image
previous_image returns a link to the previous image
format_string -pulls underscores out of directory and image names
make_select - generates html selector
make_switch - generates more different html selector
bread_crumb -generates html link string
set_footer - generates an html string
make_querystr (makes links) -- makes links
These should probably be else where.
image_search - looks though the entire file list for a matching image. (This one is moving -- file_data class?)
get_image_descrip -- pulls file data in (should probably move to file_data class)
bytes_to_kb -helper no html output (Might this belong in the file_data class?)
message -- returns a string with paragraph tags for some information to the user
gallery_name -- returns a the title of the gallery with h2 tags
set_navigation (pagination) -- creates pagination (html links)
next_image returns a link to the next image
previous_image returns a link to the previous image
format_string -pulls underscores out of directory and image names
make_select - generates html selector
make_switch - generates more different html selector
bread_crumb -generates html link string
set_footer - generates an html string
make_querystr (makes links) -- makes links
These should probably be else where.
image_search - looks though the entire file list for a matching image. (This one is moving -- file_data class?)
get_image_descrip -- pulls file data in (should probably move to file_data class)
bytes_to_kb -helper no html output (Might this belong in the file_data class?)