Subversion-Projekte lars-tiefland.ci

Revision

Revision 578 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
52 lars 1
<?php
2
 
3
/**
4
 * @author Lars Tiefland
5
 * @copyright 2016
6
 */
7
 
519 lars 8
/**
9
 * Alias_model
10
 *
11
 * gekürzte URLs für Artikel, Kategorien etc.
12
 *
527 lars 13
 * @package WebanOS CI
14
 * @author Lars Tiefland
15
 * @copyright 2016
16
 * @version $Id: Alias_model.php 578 2016-09-16 21:54:56Z lars $
519 lars 17
 * @access public
18
 */
52 lars 19
class Alias_model extends CI_Model
20
{
21
 
519 lars 22
	/**
23
	 * Alias_model::get_link()
24
	 *
25
	 * @param mixed $id
26
	 * @param integer $type
27
	 * @return
28
	 */
578 lars 29
	public function get_link($id, $type = 1)
52 lars 30
	{
31
		$res = $this->db->get_where('alias', array(
32
			'id' => $id,
33
			"type_id" => $type,
34
			));
35
		$row = $res->row_array();
578 lars 36
		$alias = $row["alias"];
37
 
38
		switch ($type)
39
		{
40
			case 1:
41
				$alias = str_replace('.html', '.artikel', $alias);
42
				break;
43
			case 2:
44
				$alias = str_replace('.html', '.category', $alias);
45
				break;
46
			case 3:
47
				$alias = str_replace('.html','.info',$alias);
48
				break;
49
			case 4:
50
				$alias = str_replace('.html','.hersteller',$alias);
51
				break;
52
		}
53
		return $alias;
52 lars 54
	}
55
}
56
 
57
?>