tags:

views:

111

answers:

3

I have some PHP code that generates a calendar and then outputs html to display it.

To display it on a page all I need to do is <?php include('calendar.php'); ?>.

Is this bad practice?

+1  A: 

I like to put that sort of thing in a function (or class) rather than an include.

I find that makes it a bit more flexible (especially if you need to start passing arguments to it) and easier to re-use in other places.

Mark Biek
+1  A: 

I don't think it is bad.

Maybe it's a bit strange to have one file that only does an include... But why not.

Also, it's not MVC and all that (not that MVC is mandatory anyway)... But if that's how your application is working, why not ?

Pascal MARTIN
A: 

I don't think it's bad at all. I use it for several portions of my web pages to allow easier editing.

Nate Shoffner