Welcome Guest, Not a member yet? Register   Sign In
How do I start Codeigniter?
#1

[eluser]WebSiteGuru[/eluser]
I am a newbie on this subject. OK I am confused on what to do. I had installed CI. Where do I go and start codeigniter? :red: When I go to mysite/ci it show

Quote:Welcome to CodeIgniter!

The page you are looking at is being generated dynamically by CodeIgniter.

If you would like to edit this page you'll find it located at:
system/application/views/welcome_message.php

The corresponding controller for this page is found at:
system/application/controllers/welcome.php

If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.


Page rendered in 0.2155 seconds

I am at a lost on this one. Please help explain. How do I start learning how to use this?

Thanks!
#2

[eluser]Rick Jolly[/eluser]
Quote:If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide.
Ok, so not the answer you wanted. I just don't know how else to answer your question.
#3

[eluser]GSV Sleeper Service[/eluser]
place one foot on the chassis, firmly grip the pull-string and pull quickly.
#4

[eluser]narkaT[/eluser]
[quote author="GSV Sleeper Service" date="1225984357"]place one foot on the chassis, firmly grip the pull-string and pull quickly.[/quote]

don't forget to check the fuel-tank Wink
#5

[eluser]ray73864[/eluser]
and mustn't forget to prime the fuel line, three presses of the primer should be enough to get fuel going through
#6

[eluser]GSV Sleeper Service[/eluser]
seriously though. read the user guide, read it again, once more for luck, follow the blog tutorial, start coding.
#7

[eluser]johnwbaxter[/eluser]
Do you know any php yet? (that isn't meant to sound mean, it's a serious question cos you never know)
#8

[eluser]obiron2[/eluser]
OK,

absolute basics - coz I had to do this to get my head around how it all worked.

The text you can see in your browser is generated from a VIEW, in this case welcome_view in the application-->views folder.

This view is called from a a CONTROLLER, in this case Welcome in the application-->Controllers folder.

open the Welcome.php file in notepad or preferably a good PHP editor (I use HAPEDIT, but if you search the boards you will find recommendations for lots of them)

Look and understand the code. the last bit is

Code:
$this->load->view('welcome_view')

this is the bit that actually generates the HTML. If you edit welcome_view.php you will change the text that is output to the browser.

So how did CI know to call that controller. Well in the config file is a default controller. The config file is in Application-->Config.

if you open config.php you will see some parameters, one of which is default_controller.

So CI works by asking for three bits of information:
The controller (Welcome.php)
The Method
The Parameters

If you don't supply the controller (i.e. www.mywebpage.com) then it will use the default controller

If you supply the controller (i.e. www.mywebpage.com/testcontroller, but not the method it will supply the details from the index function of the controller you specified and output the view as requested in that method.

If you supply the controller and the method it will run the code in the function of the controller specified and output the view requested in that function.

If you supply the controller, method and parameters (i.e. www.mywebpage.com/testcontroller/testfunction/myname/userid) then the parameters (myname & userid) will be used in the function (testfunction).

Try this.

Copy Welcome_view.php to my_view.php and edit the text.
In Welcome.php change the $this->view->load('welcome_view') to $this->load->view('my_view')

your web page will now show your new text.

copy Welcome.php to Mycontroller.php.
Change the 'Welcome extends class' at the top of the file to 'Mycontroller extends class'
Change 'function Welcome' to 'function Mycontroller'
change $this->load->view('my_view') to $this->load->view('mynew_view')

Create a file called mynew_view.php in the views folder and put some text into it.

type 'www.mywebpage.com/index.php/mycontroller' into your browser.
If you have htaccess set to suppress the index.php then type
'www.mywebpage.com/mycontroller'

you should now see your mynew_view page
#9

[eluser]bastones[/eluser]
If you don't know PHP, its best not to delve into CodeIgniter right now. CI is PHP-specific framework; therefore advanced PHP experience is required. It's easy to learn but the concept of the code especially is based around more complex code such as object-oriented programming. Your best bet (if you don't know PHP) is to learn it, use it and forget about CI for now. If you do know PHP, and you're just wanting to know the transition from ordinary coding to CodeIgniter framework coding, well its easy. The user guide really is the best place to go - 99.999% of us would be dead without it (literally!), so first of all go here and read about Controllers. The main concept of CodeIgniter is that it completely separates code from one another, which keeps it nicely tidy.

Remember if you don't have enough PHP experience, just keep CI on your computer for another day and just concentrate on making cool PHP apps without it Smile.

...I'm sorry for the stupid sarcastic posts in here, some people are a little stupid when coming to newbies, when even they were once one.
#10

[eluser]WebSiteGuru[/eluser]
OK! I guess since more than one person mentioned about if I know PHP. Well to sum it up "I don't know PHP", in the past I have hack my ways through PHP codes. But I never actually sat down and wrote an application. I am trying to learn PHP (I think I had mentioned it in the other thread) so I can write my own PHP codes. I guess I'll have to go find other place to learn the basics first.

Thanks everyone for the inputs and the explainations. I did understand it a little bit more now.




Theme © iAndrew 2016 - Forum software by © MyBB