CodeIgniter Forums
Properly structuring methods/views in classes - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Properly structuring methods/views in classes (/showthread.php?tid=53934)



Properly structuring methods/views in classes - El Forum - 08-14-2012

[eluser]mabright[/eluser]
Hello,

I am writing a, lets just call it a classifieds script. I have a class called POST. I currently have several methods in this class such as ones for showing all ads (based on user's current location/area), posting a new ad, previewing ad before posting, searching post, etc.

My home page actually starts off with this class so the home page is mysite.com/post and here is where I show a listing of current post based on where the user is located (city,state).

I am thinking that I need to separate the out some of the methods/functions in this class but not sure how. I thought of this when I was developing the preview method for when new ads are posted and I had issues going back and forth between preview and edit ad methods, etc..

So basically when a users searches or views posts the url is mysite.com/post. When a user adds an ad the url is mysite.com/post/add, preview is mysite.com/post/preview, etc.

Am I doing this correctly is the normal/standard practice as far as structuring this class, methods, etc.?