Pdf-xchange 0 Examples
Download 6.97 Mb. Pdf ko'rish
|
konf02
- Bu sahifa navigatsiya:
- Og‘irlik
- Unsiya
- CONTROLLERS IN CODEIGNITER
tasvirlash dasturi”, “O‘lchov birliklari dasturi” kabi dasturlari hisoblash
ishlarini bajarishda qo‘l keladi. “O‘lchov birliklari dasturi” uzunlik, og‘irlik, hajm, tezlik, maydon, harorat kabi o‘lchov birliklar (matematik miqdorlar) qiymatini ko‘rsatib beradi. Agar “Og‘irlik” bo‘limi tanlansa, og‘irlik o‘lchov birliklarini bir-biri bilan ifodalaydi. Masalan, undagi “Kilogramm” oynasiga 1 kiritilsa, uning yonidagi “Hisoblash” tugmasi bosilgach, 1 kilogramm necha gramm, karat, unsiya, draxma, funt, pud, livr bo‘lishi, ya’ni kilogrammning boshqa kattalik (miqdorlar) orqali ifodalanishi keltiriladi. “Unsiya” oynasiga 1 kiritilsa, uning yonidagi “Hisoblash” tugmasi bosilgach esa, 1 unsiya necha kilogramm, gramm, karat, draxma, funt, pud, livr bo‘lishi ifodalanadi. Shuningdek, “Uzunlik”, “Hajm”, “Tezlik”, “Maydon”, “Harorat” bo‘limlar tanlansa ham ularga tegishli o‘lchov birliklarini bir-biri bilan ifodalaydi. Xulosa qilib aytganda, “Chiziqli funksiya va uning grafigi” mavzusini oʻqitishda elektron ishlanmadan foydalanish ta’lim sifatini oshirishga xizmat qiladi hamda oʻquvchilarda fanga boʻlgan qiziqishni oshiradi. 32 CONTROLLERS IN CODEIGNITER Khashimov A. Tashkent University of Information Technology Ferghana branch The MVC pattern is popular in all languages and in particular PHP. MVC is the model, view, controller paradigm in programming. We’ll take a look at controllers now, as they are the portion of the MVC approach that handles incoming HTTP requests, and direct your application to take action. Controllers are used in all flavors of frameworks, and each has their own attributes. For this demonstration, we’ll focus on codeigniter. What is a Controller? A Controller follows a naming convention such that a class file is loaded based on the name of the first segment of the URI. For example if you have the URI http://www.site.com/index.php/sayhi/this will load a controller named sayhi.php. Let’s have a look at some code that would show what the sayhi.phpcontroller would actually look like. class Sayhi extends CI_Controller { public function index() { echo 'I will now say hi!'; } } ?> This controller file is saved in the application/controllers directory. Now to execute this script you would simply visit your URL similar to http://www.site.com/index.php/sayhi/ and you should see the output I will now say hi! Some key points to remember when dealing with creating your own controllers is that the name of the controller should be uppercase and it extends the parent controller class. This is so that your new controller automatically inherits all of the built in methods and functionality of the parent class. This is the benefit of using a framework, you get access to tons of functionality that has already been written for you. What is a Method? A method is also called a function in object oriented programming. So far we have only seen an index() function in our code. This is the default action that takes place if no action is specified in the second segment of the URI. Remember the format of MVC follows http://www.site.com/ Download 6.97 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling