Welcome Guest, Not a member yet? Register   Sign In
CI for a Professional Project?
#1

[eluser]gilgalad[/eluser]
Helo Php Gurus,

I'm a Computer Engineer student from Turkey, and i'm building a "final project" for my graduation. I've decided to build a different news portal with PHP. So i find you and your great framework.

But, i've exemined that with CI, there is a different coding approuch to php projects. Ok , object oriented is really tasty but, for me it's a little weird, but i've to accept that it's more and more professional.

In time I'll ask a couple of questions for my project, but at first i've to ask a simple one:

Think that, you have an index.php file that includes latest news, latest comments, latest etc.. With classical approuch, i would create different files like latestEntries.php, latestComments.php than with an easy include() function, i would add them to my index.php file.

But in CI it's really different. How can i import different files, or is that neccesary?

And, is there any sample "tiny" projects like that? I've watched your videos and read your guides, but i couldn't find the key i think.


All your helps will be appreciated.


Kindest regards.
#2

[eluser]nmweb[/eluser]
Once you go proper oo there really is no going. Once you get the hang of it you'll code better, clearer and with fewer bugs. CI only promotes OO partly but enough to get you going.

Your index.php in CI is the default controller, the controller people end up in when they type in www.yoursite.com

Ideally you'd have a model for entries and one for comments. You'd load these models, retrieve the information with $this->entries->get_latest(10) same for the comments. Put this information in a resultset and pass the resultset over to a view: 'latest_entries.php' in which you loop over the resultset and output nice html.

These views should be subviews of your template view.

Sometimes it's easier to use hmvc for your subviews. You might want to look at hmvc implementations for CodeIgniter to ease up handling parts of a page. Search for the thread.
#3

[eluser]sherpa[/eluser]
hi gilgalad, i think i have your answers. I have made a small news site using CodeIgniter which sources might be helpful for you. However news site is not in an English language but i think the sources may help you to understand how to code and manage the sections i.e. Top 10 News, Opinion, Literature, Breaking News, Archives, Main Photos etc in CodeIgniter.

Right now i don't have those file zipped with me as i'm already out of my office. So, the day after tomorrow i can make it and PM you if you really need it.

By the way, i'm not a CI guru. i made it in the process of learning CI. Tongue

sorry for my eng. Smile
#4

[eluser]Michael Wales[/eluser]
Quote:With classical approuch, i would create different files like latestEntries.php, latestComments.php than with an easy include() function, i would add them to my index.php file.

Although CodeIgniter achieves this in a different manner (technically), it is essentially the same functionality, and then some.

It will promote the MVC concept, leading you to truly separate your data, presentation, and logic. This is a higher level of development than what you were probably taught within your class, as it not only focuses on writing good code, in terms of function, but also in writing good code, in terms of maintainability. Your code will be easier to work on, during this projects development, and in the future. When you come back in 2 years you will be able to quickly understand what you were attempting to accomplish with any given segment of code.

It's going to greatly cut down on the amount of time it takes you to complete your final project - as you won't be "reinventing the wheel" to create a lot of the functionality you desire. Database connectivity, routing, session handling, form processing and validation - it's already done for you. You just implement it.

On a side note - I would confirm with your instructor as to whether it would be okay to use CodeIgniter for this project. If I were the teacher, I wouldn't have an issue with it, as long as you could answer some key questions about the framework. At the minimum, you should be able to explain the bootstrap process, how routing works, and each of the libraries you use (not just about the library itself, but how CI discovers that library, loads it, and makes it available to your application).
#5

[eluser]gilgalad[/eluser]
Thanks for your precious comments.

Actually i'm an asp.net developer. My company uses Microsoft tools. Also i'm expert on C#. We are building intranet projects with .net on Oracle databases.

But i love Php. I think it gives more flexibility to their developers and i really love to be free at all.

So, i'm new at Php5. I've built many sites with php4 without OO. But with .net i've seen that MVC systems are more powerfull. Cuz you know, there was not a MVC system for asp.net (they are finally informed they'll)

I'm glad to learn about Igniter. I'm really excited, cuz i believe in Php. So i'll read and read about the framework, and yeah Michael, i've told my teacher about Code Igniter, and he told me that "if you built your project in .net, you'd be using .net framework, so there is no problem with using any php frameworks."

Of cource i'll tell all informations about CI.

See ya later.
#6

[eluser]gilgalad[/eluser]
Yeah i found a question;

In view files, i don't want to add head tag to every page. So, how can i add a stable header.php file. And where should i add it?
#7

[eluser]nmweb[/eluser]
Create a view for your header and use a layout library so you don't have to load the view on every page.




Theme © iAndrew 2016 - Forum software by © MyBB