Subversion-Projekte lars-tiefland.ci

Revision

Revision 528 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

/**
 * Alias_model
 * 
 * gekürzte URLs für Artikel, Kategorien etc.
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Alias_model.php 578 2016-09-16 21:54:56Z lars $
 * @access public
 */
class Alias_model extends CI_Model
{

        /**
         * Alias_model::get_link()
         * 
         * @param mixed $id
         * @param integer $type
         * @return
         */
        public function get_link($id, $type = 1)
        {
                $res = $this->db->get_where('alias', array(
                        'id' => $id,
                        "type_id" => $type,
                        ));
                $row = $res->row_array();
                $alias = $row["alias"];

                switch ($type)
                {
                        case 1:
                                $alias = str_replace('.html', '.artikel', $alias);
                                break;
                        case 2:
                                $alias = str_replace('.html', '.category', $alias);
                                break;
                        case 3:
                                $alias = str_replace('.html','.info',$alias);
                                break;
                        case 4:
                                $alias = str_replace('.html','.hersteller',$alias);
                                break;
                }
                return $alias;
        }
}

?>