Welcome Guest, Not a member yet? Register   Sign In
Poll: Does CI needs HTML generation inside its default libraries?
You do not have permission to vote in this poll.
Yes
22.73%
5 22.73%
No
63.64%
14 63.64%
Not sure
13.64%
3 13.64%
Total 22 vote(s) 100%
* You voted for this item. [Show Results]

Does CodeIgniter needs HTML generation in its libraries ?
#1
Question 
(This post was last modified: 11-14-2014, 02:20 AM by sv3tli0.)

Hi

I was looking at the CI libraries and I get 1 thought..
Does CI needs HTML output generation in its libraries?

What I mean..
There are libraries as Table(this one perhaps doesn't have point at all) and Calendar and even the Pagination which are generating HTML output.
! I don't say that there are not handy but perhaps we have to think for another way..
Instead of code generation, perhaps we may use default templates for those libraries which can be extended or replaced by developers. There is no point to lose time in generating output tags and elements ..
The only point of those libraries should be a calculation and Data generation, after that it can be manipulate fastest and easiest by using some default templates.

Regards
Best VPS Hosting : Digital Ocean
Reply
#2

I agree with your last point.

I think that the libraries generating the data and returning it for simple inclusion into our own HTML or other layout method gives maximum flexibility.

This would also solve the problem of HTML 4 or HTML4.1 or XHTML and also makes it more straight forward for styling.

I wonder if this approach would cut down on the PHP fragments scattered all over a View?
Reply
#3

(11-14-2014, 01:44 AM)sv3tli0 Wrote: Instead of code generation, perhaps we may use default templates for those libraries which can be extended or replaced by developers. There is no point to lose time in generating output tags and elements ..

What problem are you trying to fix? In my opinion, if your concern is performance, a template engine won't change anything.
Reply
#4

(11-14-2014, 01:17 PM)includebeer Wrote:
(11-14-2014, 01:44 AM)sv3tli0 Wrote: Instead of code generation, perhaps we may use default templates for those libraries which can be extended or replaced by developers. There is no point to lose time in generating output tags and elements ..

What problem are you trying to fix? In my opinion, if your concern is performance, a template engine won't change anything.

Its not about using a template engine.. CI doesn't have a Template Engine (if I skip Parse which is really sample) .
There is no point set up with PHP HMTL elements with hundreds settings and at the end when you have a lot of people online to have unnecessary load for that HTML generation
Best VPS Hosting : Digital Ocean
Reply
#5

(11-15-2014, 11:29 AM)sv3tli0 Wrote: There is no point set up with PHP HMTL elements with hundreds settings and at the end when you have a lot of people online to have unnecessary load for that HTML generation

If it's not for a static page, you need to generate the HTML code. Why reinvent the wheel when the framework provides a class for that?
Reply
#6

There is difference if your class generate data and loop it inside one template file and if this class generates data and after that generates HTML..
And sorry about the wheel but we are talking for improvements.
Best VPS Hosting : Digital Ocean
Reply
#7

Did i understand right? You mean a Library to gererate a HTML Table and print it complete out to the view? For that the class must do the loop and it makes no difference to do that directly in the view with a better control for needed logic.

Reply
#8

(11-16-2014, 09:24 AM)Rufnex Wrote: Did i understand right? You mean a Library to gererate a HTML Table and print it complete out to the view? For that the class must do the loop and it makes no difference to do that directly in the view with a better control for needed logic.

Perhaps I am too overhitted at the moment and I can't understand you. 
So I will make examples:|

Pagination: Should have 3 parts (with namespaces they would be classes) inside the class:
- Routing Logic ( responsible for url parsing and url generation )
- Calculation Logic ( generation of all data depending on all inputed data) ! WITH NO HTML as it is now..
- Output - Either catch the generated Data or render view with it (default or custom)

To configure what HTML elements should you get from such class is not right.. 
Some helpers are for HTML rendering but Libraries should be Logic Only
Best VPS Hosting : Digital Ocean
Reply
#9

@sv3tli0: i'm also a bit confused ;o)

I thought you want have a lib for generation html tables... ^^.
For the pagination stuff it could be more flexible, thats right.

Reply
#10

(11-16-2014, 12:59 PM)Rufnex Wrote: @sv3tli0: i'm also a bit confused ;o)

I thought you want have a lib for generation html tables... ^^.
For the pagination stuff it could be more flexible, thats right.

https://github.com/bcit-ci/CodeIgniter/b.../Table.php
Best VPS Hosting : Digital Ocean
Reply




Theme © iAndrew 2016 - Forum software by © MyBB