Adding CodeIgniter to an existing site - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Adding CodeIgniter to an existing site (/showthread.php?tid=5029) |
Adding CodeIgniter to an existing site - El Forum - 01-01-2008 [eluser]Unknown[/eluser] Hi everyone, Happy New Year. I already have a site setup with folders structured in a certain way e.g. mainsite mainsite/css mainsite/includes mainsite/scripts mainsite/media mainsite/subsite1 (layout) mainsite/subsite1content mainsite/subsite2 (layout) mainsite/subsite2content etc etc If I want to use codeigniter does it mean everything must now be restructured according to the folders for the codeigniter setup? Or can I keep my existing folder structure? Thanks in advance. Adding CodeIgniter to an existing site - El Forum - 01-01-2008 [eluser]axle_foley00[/eluser] You could keep your existing structure and put your CI based application in a sub-folder under your main site. Or is this not what you would like to do? Edit: But if you were planning to redo the whole site with CI, then you could probably use URI Routing to keep your current structure. Adding CodeIgniter to an existing site - El Forum - 01-01-2008 [eluser]tonanbarbarian[/eluser] in reality the only file needed by CI to be in your webpath is the index.php, and even that can be renamed. For example you can rename the index.php to app.php and put it anywhere Then just make sure that the paths are correct in the new app.php file, and that in the config.php you change the Code: $config['index_page'] = "app.php"; Personally I always only have the index.php and any external files such as image css js etc in the webpath. I generally stick CI in one central location on the server so that all sites can use it, and then I have another common area for applications, in case I have multiple sites that need to use the same code. Not only does this allow you to centralise your code, it improves security because the only file that is directly accessable is the index.php Adding CodeIgniter to an existing site - El Forum - 01-01-2008 [eluser]Unknown[/eluser] Thanks guys...will keep files where they are, and put CI outside the web root. Adding CodeIgniter to an existing site - El Forum - 02-19-2008 [eluser]Puleen[/eluser] [quote author="tonanbarbarian" date="1199237064"]Personally I always only have the index.php and any external files such as image css js etc in the webpath. I generally stick CI in one central location on the server so that all sites can use it, and then I have another common area for applications, in case I have multiple sites that need to use the same code. Not only does this allow you to centralise your code, it improves security because the only file that is directly accessable is the index.php[/quote] I am newly exposed to CI and would like to ask if you could further elaborate on the above. I've thought of how I can approach this for a few of my sites and being a newbie am trying to wrap my head around this concept. If you could give an example of how you are using CI as a common base for all your websites would really help me understand this concept. Thank you in advance for your help! Adding CodeIgniter to an existing site - El Forum - 02-19-2008 [eluser]Pascal Kriete[/eluser] If you open up your index.php file you'll see that it specifies two paths. One for the system folder, and one for the application folder (which you can rename, btw). All your sites can share one system folder, located anywhere on your system. For example mine reads: /Applications/MAMP/CI/system For you application folder you can do the same thing, but obviously every application will need it's own index.php file (you will probably rename them as well) and usually it's own application folder. Again, here's the basic path for mine: /Applications/MAMP/CI/apps/<appname> Adding CodeIgniter to an existing site - El Forum - 02-19-2008 [eluser]Puleen[/eluser] inparo, thank you very much for clarifying that. Now I understand the structure a little better. Adding CodeIgniter to an existing site - El Forum - 02-19-2008 [eluser]pgsjoe[/eluser] I am also trying to implement Code Igniter into an existing site and here's my question. I have the same layout for each section of pages. For instance, the 'About' section has the same header, callout, side navigation and footer. Only the content changes between the pages. But then between the 'About' and 'Contact' page, the callout and content change. My question is, how do I set this up in CI? Like, what's the structure for doing such a thing? Would I put each callout image in it's own database table and call it to the page? Would all of the content be placed into the database and pulled from there, even images? Or, would I create a separate view for each page? What would be a view and what would be a controller? (I'm guessing the SECTION [about, contact, etc.] would be the view?) If I have stuff in DIVs, would I only pull the content into the page, or include the divs with it wherever the information is stored? Thanks in advance. |