code igniter framework guidance for beginners - codeigniter

I am just a beginner in code igniter. I have just downloaded the code igniter framework. But i don't know that where should i keep my html, php files and stylesheets, images etc. Is there any procedure to do the things? Please guide me.

CodeIgniter has an awesome user guide that will come with the install you can read through (or read it online at - http://codeigniter.com/user_guide/ ), or you can watch some of the videos on their site - http://codeigniter.com/tutorials/
In comparison to most other frameworks you're going to find they have maybe the smallest learning curve and great documentation. I would also recommend learning basic PHP and getting familiar with your web environment maybe before beginning.

I used these tutorials to help get me started with the framework haven't look back since! http://net.tutsplus.com/sessions/codeigniter-from-scratch/

hi I am a weekend coder and picked up CI about a year ago.
It helped me a lot.
The best tutorial I found was on the IBM's developer site. It runs through putting together a simple application. Admittedly, there's nothing in it about directory and file placement but it helps cement ideas about how models, views and controllers (MVC), and why MVC is so helpful. Because the basic idea is quite simple, it's worth running through a simple CI tutorial again and again till you 'feel' or intuit the basic helpfulness of the setup.
Things like JS, CSS files can be kept in their own folders at the first level of your website folder e.g /js or /css or /images. You ask about PHP files as well. PHP files which you, the coder, write, are either 'views', 'models' or 'controllers'. These go in the folders with those names in the /application folder e.g /application/views/yourview.php or /application/controllers/yourcontroller.php. The CI install comes with a default view file and a default controller, which you are probably already aware of.
The files inside /application/config are important as well. Read the user-guide about tweaking these files. The most obvious tweaks are to database.php to connect to your db, autoload to give automatic use of CI helpers/libraries which you can choose, and to config.php to give CI the name of your website e.g the name you give to '/'.
The file 'index.php' comes with the CI installation (/index.php). You don't need to fiddle with it at all really except to determine the level of error reporting you want ('environment') and that's not a priority at all. But it's important to remember this about index.php - that CI uses it as the essential reference for defining paths to useful folders like CSS or images. So even if your view file is in /application/views, if it refers to an image like a logo.gif in /images for example, the path to it is just /images/logo.gif. It is not anything more complicated like ../../images/logo.gif.
I hope that helps.
Tom

Offline version of CodeIgniter user guide is available with CodeIgniter which already downloaded by you.
just extract your CodeIgniter zip file in your localhost server root directory,
Then http://localhost/www/CodeIgniter_2.1.2/user_guide/ open this url with browser ,here you can access offline version of CodeIgniter user guide.
Here I am using wamp server so I used this url, If you are using xampp server then please use http://localhost/CodeIgniter_2.1.2/user_guide/

Okay this is what I would usually do for code igniter
here is my directory structure.
CI App Path (e.g "c:\xampp\htdocs\ci_app_name" )
-application
-system
-assets
--css (new folder , where css files will be included)
--js (javascript and jquery libraries location)
Basic HTML and PHP files should be location
CI_app_pah
-application
--views (this is where to put HTML and PHP files)
For other things such as Controller , Models and Views , you can't put any where but put in their related area.
That will be
CI app
-application
--controllers
--models
--views

Related

Codeigniter 4 Modules not working properly

I have been trying to setup codeigniter 4 modules but it seems something is not working properly
it takes me to 404 or not found.
i have gone through this doc : https://codeigniter4.github.io/CodeIgniter4/general/modules.html?highlight=modules
I have simply installed Ci4 and follow this doc did not tweaked anything else as we do in previous ci 3 hmvc practice.
Is there anything else beside autoload ?
I'm basic php dev. please guide.
As DFriend indicates, it's difficult to know what the issue could be based on the minimal information provided.
That said one difference between CI3 and CI4 that I noticed is the location of the base index.php, which in CI4 is located within the "public" directory. So, assuming you are using Apache, you need to adjust it's default directory to include public.
_t

External PHP Include in Laravel

We run a main website which is not made in Laravel. A specific script on this website however is made in Laravel. We need this script (or to be exact, a specific view inside of it) to fetch some resources from the main website (PHP files which mainly include HTML). When, inside the Laravel application, we try to include these resources, we can not - as they don't exist in the Laravel project workspace. This results in an error that the file does not exist. Attempting to climb out of the project (../../../file.php) does not seem to help either.
We're including it this way:
<?php
include '~/template/nav.php';
?>
We don't wish to include this file into the actual Laravel project, as that would require having to update it twice to ensure they remain equal. Is there any way for us to include this "external" file in our view? Every bit of research done seems to suggest adding it into the project, which would just cause twice the amount of administration on updates.
Cheers!
Just faced same problem. My Laravel Project is an API that need's to include outside php file. So what I did was specify entire path:
include($_SERVER['DOCUMENT_ROOT'].'/../../my_example_file.php');
$_SERVER['DOCUMENT_ROOT'] will lead you to Laravel's public folder.

install kohana into another website

I have a website that is built with kohana and another one that is built without any framework. I would like to include the first site into the second as an application ( you can write only a report with it).
The first website it's not mine( I never used kohana) so I don't understand everything very well. Inside a folder(let's call it KOHANA) I have index.php a .htaccess file and other 3 folders:
application,
system,
modules.
I've put the kohana folder inside my website(inside the public_html folder), but nothing works...First I had an error with magic quotes, then with the log directory, the other errors ...and I kept looking for solutions and fixing the errors, but I keep getting other errors. The last one is: logsThe URI you submitted has disallowed characters. It's an old version of Kohana. How can I set-up kohana into my website without getting any new errors. I don't know if I made myself clear. Thank you.

wkhtmktopdf on shared hosting does not return any data...?

Hi friends currently i m working on a small business project.
for this project i need to convert my dynamic html page into a PDF file..
I googled for html to pdf and found wkhtml...
in my local-host system its works like charm..
But in my shared server it does not gives any output... errors also. when php wrap execute, it fails silently..
Any idea guys??
another thing.. In my shared hosting, they are disabled exec,proc_open and other process related functions, So i used .htaccess file to point another php.ini for reconfiguring the disabled_functions.
Because your hosting provider has disabled the exec methods, I'm sure they won't be pleased to find out you're trying to use wkhtmltopdf. It might be a good idea to contact them about your plans.
When downloading wkhtmltopdf, make sure you grab the right package (based on the server specs). Your best bet is to use one of the static packages as it provides most of the libraries needed to run wkhtmltopdf. You might also need to change the file permissions to be able to execute the file.
Lastly, make sure your custom php.ini is even used by php (calling phpinfo() will do the trick).

CodeIgniter Application Within an Existing Site

Our corporate website already is in place written in "long-hand" PHP. Since we plan to rebuild the site some time in 2011, I don't want to recode it in CodeIgniter (MVC) until we begin the redesign.
However, there are some additions we are making now (i.e., a newsroom/rss feed, a jobs post, etc) that I could add to the site as "modules" until the new design is created in CodeIgniter.
My question -- can I place a CI2 "application" in a folder at the root of my existing site and create my modules in CodeIgniter. For example, a stand-alone CI2 site named news would live in a folder at the root and would be called like www.company.com/news?
Thanks in advance for your insight,
Jon
My question -- can I place a CI2
"application" in a folder at the root
of my existing site and create my
modules in CodeIgniter. For example, a
stand-alone CI2 site named news would
live in a folder at the root and would
be called like www.company.com/news?
Yes you can...
anything else? ;)
All joking aside, you could probably stick it into something like /ci/ and use .htaccess to make URL rewriting, and point your sites /news --> /ci/news/etc;
That way you have 1 single CI instance, and you just point links to the instance:
/news => /ci/news/view/
/form => /ci/form/process/1
etc; number of ways to do it.

Resources