Kirim Email

Mengirim email merupakan salah satu langkah yang sudah umum ada pada aplikasi berbasis web digunakan untuk membuat fitur lupa password, verifikasi email, dan notifikasi. Di Seme Framework sudah ada library untuk mengirim email. Namun, pastikan juga aplikasi sudah terinstall send_mail pada server. Pada library Seme Email ini juga tidak ada dukungan untuk menggunakan SMTP custom maupun library lainnya. Jadi yang harus di setting itu nanti akan ada di aplikasi send_mailnya, bukan di level code.

Aplikasi biasa diinstall aplikasi untuk mengirim email di server.

    Membuat layout

    Pertama-tama kita akan membuat layout khusus untuk notfound. Biasanya, halaman notfound ini memiliki struktur HTML yang berbeda dengan halaman lainnya, sehingga harus memiliki layout khusus. Buat file baru di app/view/front/page/notfound.php untuk layout notfound.

    <!DOCTYPE html>
    <html>
      <?php $this->getThemeElement('page/html/head', $__forward) ?>
      <body>
    
        <div class="container">
          <div class="row">
            <div class="col s12">
              <h1><small style="color: rgba(0,0,0,0.5);">Error 404</small> Notfound</h1>
              <p>Oops, looks like this page doesn't exist</p>
              <hr>
              <h5>Back to <a href="<?=base_url()?>">Homepage</a></h5>
            </div>
          </div>
        </div>
    
        <!-- jQuery, Bootstrap.js, jQuery plugins and Custom JS code -->
        <?php $this->getJsFooter(); ?>
    
        <!-- Load and execute javascript code used only in this page -->
        <script>
          $(document).ready(function(e){
            <?php $this->getJsReady(); ?>
          });
          <?php $this->getJsContent(); ?>
        </script>
      </body>
    </html>

    Menyesuaikan Controller Notfound

    Setelah layoutnya selesai, tinggal penyesuaian di app/controller/notfound.php.

    <?php
    /**
     * Controller class for throw 404 response code
     *
     * @package SemeFramework
     * @since SemeFramework 1.0
     *
     * @codeCoverageIgnore
     */
    class NotFound extends SENE_Controller
    {
        public function __construct()
        {
            parent::__construct();
        }
        public function index()
        {
            $data = array();
            header("HTTP/1.0 404 Not Found");
            $this->setTheme('front');
            $this->setTitle('Notfound - Error 404');
            $this->loadLayout("notfound",$data);
            $this->render();
        }
    }

    Mencoba halaman notfound

    Untuk mencoba halaman notfound, cukup ketikan sembarang URL setelah base_url-nya. Lihat contoh dibawah ini

    http://localhost/seme_framework/asdasdasad