Welcome Guest, Not a member yet? Register   Sign In
Using Codeigniter classes
#1

Can I use Codeigniter classes without implementing the whole mvc pattern the same way I can do it with Zend? For example, I would love to be able to use just some validation classes, or email class etc..
Reply
#2

its quite simple to write your own classes to do the processing ; to be honest i use my own validation for code, because that way I know whats going on and understand whats going on. I also have my own email class for a controller because i use PHPMailer. There isn't really much to using a controller a few lines then your own OOP class and their methods.

For a view its quite simple pass data to a view with a few lines
Code:
    try{        
                            
                                $logic2 = $result=            $mail->send();
                                           if (($logic2==1) OR ($logic2=="true"))
                                         {
                                          $data = ['title' => 'sending email ',
                                          'info'    => 'your message was sent ',
                                          'date'=>$this->myDate
                                                  ];
                                                            
                                         echo view ('info',$data);
                                        
                                         }
                                        
                        }

because the bulk of all web pages can use a template , then the total for a info.php view is just
Code:
<?= $this->extend('layout') ?>
<?= $this->section('content') ?>

<div class ="flex2">
    <div class="content">
    
    <h11><?php echo $info;?></h11>
    </div>




</div>
</div>
<?= $this->endSection() ?>
CMS CI4     I use Arch Linux by the way 

Reply




Theme © iAndrew 2016 - Forum software by © MyBB