Welcome Guest, Not a member yet? Register   Sign In
New Code Igniter tutorial series
#1

[eluser]Dam1an[/eluser]
Hi everyone, I'm currently working on a tutorial series for code igniter, of which the first part is now online (direct link)
You can also find the links to all the parts as they appear here
If you like my blog, feel free to subscribe to my RSS .

Thanks guys
#2

[eluser]Drew Barontini[/eluser]
Looks good, man! I'm a relatively new PHP/CI programmer and I'm looking forward to reading through these. Keep it up!
#3

[eluser]Taff[/eluser]
Thanks Dam1an.
I have read a fair bit here on the forums about changing the file structure.
Your tutorial shows me how.

Taff
#4

[eluser]wiredesignz[/eluser]
Ellislab are pretty staunch about the name CodeIgniter being used rather than Code Igniter.

Also your Controller example does not initialize itself, it may work in the example but is misleading for a newbie if they then try to $this->load something.

Other than that.. nice work.
#5

[eluser]Dam1an[/eluser]
I'll be sure to call it CodeIgniter from now on, honest!
Also, I intentionally neglected to mention the constructor, as its not needed at this early stage, but as soon as I start showing how to load libraries/helpers/models etc, I'll obviously introduce it, end explain what/why its used.

Thanks for the comments so far
Be as harsh as you can, as the more you point out, with regard to Codeigniter and the style of the tutorial, the better it will be for everyone.

Cheers
#6

[eluser]Derek Allard[/eluser]
Dam1an, welcome into CodeIgniter - thrilled to see your series, looks like a great start.
#7

[eluser]Dam1an[/eluser]
Got part 2 up now, its a quick intro to .htaccess, and how to use it to get clean URL's

Direct link

The series

I'll hopefully get part 3 up which will start talking about views in the next few days, assuming I'm not too busy with exams
#8

[eluser]Daniel Moore[/eluser]
Dam1an,

Always great to see tutorials up that are needed to help people get up to speed on CodeIgniter.

If I may quote you, you said, "Be as harsh as you can, as the more you point out, with regard to Codeigniter and the style of the tutorial, the better it will be for everyone." (If I can't quote you, well you still said it.)

As I assume you are looking for "constructive" criticism so that you can make it the best possible tutorial for all users, I have noticed something in your .htaccess tutorial that could use addressing.

Your .htaccess tutorial will not work for all installations for CodeIgniter. Everyone I work with, and many people in the hard core programming world, prefer the added security of placing the /system directory outside the web root, and some have multiple code igniter applications at a particular site. You have written the following rewrite rule:
Code:
RewriteRule ^(.*)$ /index.php/$1 [L]
This will not work for many installations, as it assumes the index.php is in the root directory, which it is not always in the root, especially on development machines where you may be developing multiple CI applications. It would be better to write it as:
Code:
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
As you can see, I use a dot before the slash before the index.php to tell the rewrite rule to look relative to the current directory. It works flawlessly.

I work on multiple servers, with multiple versions of apache. Some older versions do not behave well with the .htaccess you have, and and this issued has been solved across all apache servers by using the following .htaccess file:
Code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

Good luck with the tutorial series!
#9

[eluser]Dam1an[/eluser]
Thanks for pointing that out with regard to the .htaccess rewrite rules, I'll go make the update on the blog now.
Also you mention that all hard core programmers keep the system folder out of the web root, I specifically mentioned this in part 1, so that all that is in the web root in index.php, and the contents of the application folder (models, views, controllers etc).
I have been doing this all along, and never noticed any problems with that.

Also, I did overlook needing the '.' in front of /index.php, as normally, when I work on multiple sites, I just hard code the folder name (having forgotten it would be relative to the current directory).

Once again, thanks for pointing it out =)
#10

[eluser]onejaguar[/eluser]
[quote author="wiredesignz" date="1211203944"]
Also your Controller example does not initialize itself, it may work in the example but is misleading for a newbie if they then try to $this->load something.
[/quote]

What do you mean "initialize" itself? Doesn't that happen automatically? You only need to do your own constructor if you want to do something special EXTENDING the default initialization. You can do all the $this-> you want simply because you are extending the base controller.




Theme © iAndrew 2016 - Forum software by © MyBB