Welcome Guest, Not a member yet? Register   Sign In
How do you set up your code igniter script?
#1

[eluser]Leggy[/eluser]
Title says it all... How do you set up your website while using code igniter.

My method doesn't take advantage of all of code igniters features but i plan to be updating it fairly soon.

In the controller i call a view called main, this pulls together all of the sections (header, footer, head tags, etc). When getting the main content the main view would find what page the url is asking for using "$this->uri->segment()" then call the view related to it.

So what's your method?
#2

[eluser]nate_02631[/eluser]
I wouldn't exactly say "title says it all" Wink I personally am not quite clear what you're asking for, the question is a bit generic/vague...

I generally have a view for most of my controllers (which do call common elements, headers, footers, etc...). My controller views are "proper" full HTML pages (with title, meta tags, style includes, etc... and then I pull in header stuff just inside the body and footer stuff just below the closing body as partials/snippets. I find it better as views can be pulled into html editors without the editor freaking out about incomplete structure, etc...

I do have a site that uses some legacy static pages where I have a controller such as:
Code:
function content($page) {
  $this->load->view('content/'.$page);
}
In general, I try to stay away from uri->segment and use the function variables (i.e. $page is the first var that follows the controller name in the uri, and subsequent vars, etc...) as it makes the app more portable.
#3

[eluser]Leggy[/eluser]
Sorry if the question was a bit vague, you managed to answer it though. All of my pages are proper xHTML, i make sure of it. I just set mine up for ease of use, i will be making it more easy to use soon though.
#4

[eluser]pwninja[/eluser]
[quote author="nate_02631" date="1195420873"]... I generally have a view for most of my controllers (which do call common elements, headers, footers, etc...). My controller views are "proper" full HTML pages (with title, meta tags, style includes, etc... and then I pull in header stuff just inside the body and footer stuff just below the closing body as partials/snippets. I find it better as views can be pulled into html editors without the editor freaking out about incomplete structure, etc...[/quote]

Nice idea, I think I'll try that on my next project.
#5

[eluser]Michael Wales[/eluser]
Depends on the site... in most cases I have a folder in my views named _global which houses my header and footer. The rest of my view files load the header and footer views themselves, passing along variables as necessary (keywords, description, etc).

I also create a new folder within views for each controller - so all of a controller's views are organized.
#6

[eluser]maadmac[/eluser]
Also, check out $this->load->vars() in the user guide. Rick Ellis has an example somewhere here in the fora, if you've never used that before it's quite handy...
#7

[eluser]pwninja[/eluser]
[quote author="walesmd" date="1195443901"]Depends on the site... in most cases I have a folder in my views named _global which houses my header and footer. The rest of my view files load the header and footer views themselves, passing along variables as necessary (keywords, description, etc).

I also create a new folder within views for each controller - so all of a controller's views are organized.[/quote]

I do this also. Why the underscore though? purely for putting it at the start of the directory listing?




Theme © iAndrew 2016 - Forum software by © MyBB