CodeIgniter Tutorial: [Creating Accounting Application] Part 5 The Mainpage
Well I’m sorry, it’s been so long for this part to come.. I had been working very hard on some clients and don’t have enough time to write. Here’s what I had been done if you’re curious :) : http://maps.GpsTrackingIndonesia.com, www.SunberryCorp.com, www.mypushme.com, www.kulacak.com, www.web2trace.com, www.pushmeportal.com, … The fun is almost all of them was written with CodeIgniter :).
Ok, let’s start with the easiest one first. We will create a simple menu page that contains links to other modules on the system. We put it on the Mainpage controller class.
Look at the Mainpage.php controller file. There is a function on it named exactly the same with the filename: Mainpage(). This should be exactly the same including the case. This is the constructor or initialization function of the class. Each time the class is called or instantiate, this function is called automatically. We put some initialization lines inside it:
{
parent::Controller();
$this->load->helper(‘url’);
}
The line parent::Controller() calls the constructor function of this class’s parent constructor which is the CodeIgniter’s Controller class so that it has all the properties and method of it’s parent.
Then, we load a helper library that contains helper functions related to URL handling such as site_url() to return the site’s URL that we are working on. Other functions on this helper are: anchor(), base_url(), uri_string(), etc. You can check it all on the user guide http://localhost/user_guide/helpers/url_helper.html.
Again, look at the Mainpage.php file. We added a new function called index(). This function is analogous to the index.html file in static web page. It’s called by default when we point our browser to the Mainpage controller, ie: http://localhost/index.php/Mainpage.
{
$this->load->view(‘header’);
$this->load->view("main_menu");
$this->load->view(‘footer’);
return;
}
On the function, we load view files. Here we divide the view into 3 pieces: header, main_menu, and footer. They are basically just regular PHP files dealing with display templates. This will make us easier to manage the look of our application later.
All of the view files should be located under system/application/views folder on CodeIgniter file structure. So we need to create all of them:
The header.php view file, contains the opening HTML tags, HEAD, TITLE and start of BODY. Later we can add CSS link definition here:
<html>
<head></p><p><title>Cashbook application</title>
</head>
<body>
</p>
The footer.php view file, just a closing BODY and HTML tag, but you can later add your copyright notice, timestamps, etc:
</body> </html>
And the main_menu.php view file. Here we write a list of links to modules that we are going to develop later:
<ul>
<li><?=anchor("Cashbook/addNew/receive","Cash Receive Entry")?>
<li><?=anchor("Cashbook/addNew/out","Cash Out Entry") ?>
<li><?=anchor("Cashbook/viewReport","Cash Book Report")?>
</ul> </p>
<p><p>Bank Book</p>
<ul>
<li><?=anchor("Bankbook/addNew/receive","Bank Receive Entry");?>
<li><?=anchor("Bankbook/addNew/out","Bank Out Entry");?>
<li><?=anchor("Bankbook/viewReport","Bank Book Report");?>
</ul> </p>
<p><p>Manual Journal</p>
<ul>
<li><?=anchor("Journal/addNew","Manual Journal Entry")?>
<li><?=anchor("Journal/viewReport","Manual Journal Report")?>
</ul> </p>
<p><p>Report</p>
<ul>
<li><?=anchor("Mainpage/trialBalance","Trial Balance")?>
<li><?=anchor("Mainpage/balanceSheet","Balance Sheet")?>
<li><?=anchor("Mainpage/profitLoss","Profit and Loss")?>
</ul> </p>
<p><p>Posting and COA</p>
<ul>
<li><?=anchor("Mainpage/doPosting","Post transaction")?>
<li><?=anchor("Coa/listCoa","Chart of Account Setting")?>
</ul></p>
As we can see above, we call a helper function anchor(). This function will create a standard HTML anchor link based on your local site URL. So for example, if we call it achor(“Mainpage/trialBalance”, “Trial Balance”) then it will return this string:
<a href=”http://localhost/Mainpage/trialBalance”> Trial Balance </a>
assumed that you have configured your site URL as http://localhost/ on the config.php file.
Now we can run our application by pointing the browser to http://localhost and it should return something like the following:
Congratulation!
Next we will begin to code the COA module.



Nice to see you back!!
Thankyou :)
kapan code the COA modulenya….udah gak sabaran nih….di tunggu ya…thanks u :)
Amazing…….Great Work….I am waiting for Part – 6….Please post it.I really impressed with your work.My email id is azoocoder@gmail.com.Plz email me ,I want to discuss u some points.
im waiting for your “Part 6 Coding, the and COA Module explain the application coding using CodeIgniter”. when can i expect it from you???
I m Waiting for Part-6.Please prepare it as soon as possible….I found this series is too informative and interesting.
Thank you
Excellent Work.Please keep it up.I am waiting for NEXT part.Upload it soon plz……..
Thank u
This is the best workflow I have ever seen. I really like the way you present the tutorials. Please upload the 6th part soon. Thank you so much!
kapan Modul coa nya nich …. please !!!!!!
Still waiting for Part-6.Please upload it.
Great tutorials! I hope your schedule gets a little easier as I am eagerly awaiting the next part.
I had a small problem with your main_menu.php file. At first none of the bullet points came up, only the menu headings. After a little digging around, I found that you are using short tags on the line items. All I had to do to fix this problem was go into the CI config file and change the line :
$config['rewrite_short_tags'] = FALSE;
to true.
Keep up the great work!
L
Hi
Fantastic work you’ve got here, really!
Thanks for the enjoyable moment I had reading your posts.
Hope you won’t leave this piece of art unfinished… we (the nerds from your fan club)’ll be watching you
Peace
hey should appreciate your work….!
its all coz of u, noobs lik me can go ahead with CI.
Thanks a lot for sharin.
Keep up the good work
Dawsy, more than happy I could help. Thanks
Hey greetings from Caracas, Venezuela, i’m really enjoying this tutorial, please publish part 6th soon, i’m kind of php geek but i haven’t used a framework before so i want to be a Codeigniter Ninja. Thank you very much indeed. Over and out!
Current CI level: NOOB
Tony, greeting from Bandung, Indonesia! I’m really glad to finish the tutorial, but currently still have not enough time, doing some outsourcing projects. Will start to write it up bye the end of next month. Thanks a lot.
Nice tutorials. I’m a CI noob and this tuts helps me alot! Thanks, bro. Still waiting for the next part :-)
Impressive
thank’s, a nice tutorials… . It’s someting new for me
Mhhhhh……… pretty smart. Congrats. if i may request. Y dont u share the final product, coz u seem more busy lately . I realy wud love to see the final product. Being my first in CI.
thanks.
Nice Tutorial. Can I get step by step source code pleas?
Waiting for next part.
thanks in advance
Mojam, WSS
Hi
Thanks os much for this tutorial.
When will the next step be available?
Thanks
Regards
Bryce
I Appreciate your great work
Please publish rest of the parts
Thanks
Shattered this tutorial has stopped as I really got so excited till i realised it stops here. Anyone completed this. I would love to check it out
Please….please upload part 6.
I’m glad I read this entire article before I wasted my time doing the tutorial. Wouldn’t it be great if this person completed the entire application and then posted it on the site. The most important part of the application is missing.
On a positive note, I am glad to have read probably the best breakdown of a development project. Hope you will have time to complete the remaining 5 parts.