![]() |
Can someone advise what this code snippet does ? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Can someone advise what this code snippet does ? (/showthread.php?tid=60210) |
Can someone advise what this code snippet does ? - El Forum - 02-05-2014 [eluser]vincej[/eluser] HI - I pulled this out of PyroCMS which is built on CI. I can not see what the point is of these 3 lines of code: Code: $sample = new stdClass; To my eyes, all it appears to do is put the input post into a an empty class as a property ... but so what. It them goes on to use $sample as part of the view, Code: // Build the view using sample/views/admin/form.php I am obviously missing something - any ideas ?? Many thanks ! Can someone advise what this code snippet does ? - El Forum - 02-05-2014 [eluser]CroNiX[/eluser] Don't know for sure, but it's creating an object and setting various properties of that object based on some sort of validation rules array. I assume this might be a part of some auto form validation, but never used Pyro so not sure. Makes sense though since it's loading a form. Can someone advise what this code snippet does ? - El Forum - 02-05-2014 [eluser]CroNiX[/eluser] It might make sense if you look at what template->set('sample', $sample) in reference to the 'admin/form' is doing since that's where it's being passed Can someone advise what this code snippet does ? - El Forum - 02-05-2014 [eluser]vincej[/eluser] Thanks CroNix - I'm impressed you are still around ! Pyro is a great cms AND built on CI .. although for how long who knows as Phil Sturgeon ( the author ) intends to take it to Laravel 4. Can someone advise what this code snippet does ? - El Forum - 02-05-2014 [eluser]CroNiX[/eluser] Yeah I'm starting to learn L4, but have some clients with large CI sites that won't be upgrading frameworks anytime soon as there isn't an actual need to. So, I'm still around but spreading my wings. |