Welcome Guest, Not a member yet? Register   Sign In
css as plugin

[quote author="xwero" date="1241028669"]
I think Dam1an knows what he's doing but there are a lot of posts from him where i see him extending classes, this could give the impression extending classes is good for everything.[/quote]

Sorry, but I can't recall having extended a lot of base classes :S
So far, I've only extended the controller (thats the case in almost any application I make, as there's always some common code accross all my pages), the loader (which has been explained already) and the profiler (to include session data using the example code someone gave on here a few days ago)

Anyway, I'll try to be sure to think about the consequences more... honest :red:

[quote author="xwero" date="1241028669"]jdfwarrior there are different ways of doing things but every way has its consequences and this is what should be considered.

The reason why i think extending classes is the last option is because if you do something wrong in the extended class this can have effect on the parent class. Which means the debugging is going to be more difficult.
Another reason is if you extend classes quickly it's likely app specific methods are going to appear in extended classes making the extended class less of a candidate for reuse, which could mean you copy paste the methods you need every time to the extended class in all the different apps.

And as i mentioned earlier you have to consider what the method does too. Not every function needs to go in an extended class. I get the feeling some people use extended classes as another way to autoload methods.

I think Dam1an knows what he's doing but there are a lot of posts from him where i see him extending classes, this could give the impression extending classes is good for everything.[/quote]

Wasn't saying you were wrong. I agree with your thinking of, try to keep extending to a minimum and the issues extending the core could create. I personally have not seen Dam1an promoting class extensions, so I can't completely see your side of it. As I said, I was just mentioning that using it for something that's not big doesn't necessarily make it wrong.

I could have the wrong impression. It probably is a snapshot in time where there are several posts i've seen Dam1an extending a class for methods that could be placed somewhere else. My remark was not meant as a personal attack, if it felt like that i will mea culpa myself Wink

It's OK xwero, I forgive you Tongue. I think you've just been seeing a lot of posts where I mention MY_Controller (which only has 2 functions in it)

And although the methods could be moved elsewhere (and once there get to be more they may be), it didn't seem worth the overhead of creating a seperate helper/library for them (come to think of it in my case they couldn't be moved else where, due to them using protected vars used in the child controllers)

Thanks for time and ideas for this problem, all the solution are good and fit for it purpose. As I read the user guide of code igniter, all of your method are accepted and working well.

It not a major problem how to do it, but how it goes to the browser is what matter. We are building web base application and user want to see it.

I don't know why it go wrong in IE7 or 8 but it went well on firefox. But there always one side to blame. Guest who? yeah IE maker, the big M.

Thanks for all you comment, this forum is good. Thanks

abim, I usually keep it simple and just include the css file in the page's head. I think it's overkill writing any PHP functions for something so easy, unless of course the stylesheets will vary by page.

The answer to your actual question is not related to CodeIgniter or PHP, it's a CSS question so it's probably better suited for another forum.

The reason your template does not center align in IE is most likely because you are not using a proper doctype, or the doctype is not on the first line of the page. To center your page (or any page element), you must fix the width and set it's left and right margins to auto. I usually fix the width of <body> to whatever resolution I want my page to work in and set it's margin to auto.

If that doesn't help, post a link to your template and we'll figure it out.

Theme © iAndrew 2016 - Forum software by © MyBB