Demo

Probiere ClanSphere aus und teste daran herum. Demo

Codepaste - Details
Weitere Infos zum Codepaste

Name Template Switch in index.php
Autor de Jam2
CMS-Version ClanSphere 2011
Datei -/-.php
Datum 27.12.2013 um 13:13 Uhr
Beschreibung this codepast is usefull if you want to use different templates for different modules.

mod_rewrite √
all parameter included √
Alter Code Alter Code +-
 
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
1. / 2. / ... 
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$

# Overwrite global settings by using the following array
$cs_main = array('init_sql' => true'init_tpl' => true'tpl_file' => 'index.htm');

require_once 
'system/core/functions.php';

cs_init($cs_main);
Neuer Code Neuer Code +-
 
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
1. / 2. / ... 
<?php
// ClanSphere 2010 - www.clansphere.net
// $Id$

if(!empty($_GET['params'])){
    
$params explode('/'$_GET['params']);
    foreach(
$params AS $key => $value)
    {
        if(
$key != 0)
        {
            if(
$key == 1)
                   
$get['mod']        =  $value;
            elseif(
$key == 2)
                
$get['action']        = $value;
            elseif(
$key%2==0)
                
$get[$params[$key-1]] = $value;
        }
    }
}else{
    
$get $_GET;
}

if(!empty(
$get['mod']) AND $get['mod'] == 'board')
    
$htm_file 'board.htm'// example for module
if(!empty($get['mod']) AND $get['mod'] == 'news' AND !empty($get['action']) AND $get['action'] == 'list'// example for module and action
    
$htm_file 'news.htm';
elseif(!empty(
$get['mod']) AND $get['mod'] == 'static' AND!empty($get['id']) AND  $get['id'] == 43)// example for parameter like id
    
$htm_file 'static_43.htm';
elseif(empty(
$get['mod']))// example if no parameter is given (like http://www.yourdomain.tld/index.php)
    
$htm_file 'welcomescreen.htm';
else
    
$htm_file 'index.htm'// Default Template

# Overwrite global settings by using the following array
$cs_main = array('init_sql' => true'init_tpl' => true'tpl_file' => $htm_file);

require_once 
'system/core/functions.php';

cs_init($cs_main);
Zurück - Übersicht

Kommentare: 6
Seite [1]
microz

28.11.2014

Ort: -
Beiträge: 97
# 1 - 17.01.2014 um 06:37 Uhr

not works in my installation :(

update
Only works with mod_rewrite disabled.

Any sugestion?

Rgds


Zuletzt editiert von microz, am 20.01.2014 um 16:25 Uhr (2x Editiert)
Jam2 ClanSphere Team

30.07.2021

Ort: -
Beiträge: 3377
# 2 - 23.01.2014 um 20:35 Uhr

Hi mircros,
please add at the end
 
1.
1. / 2. / ... 
 var_dump($get);

and post the result of a few pages.


what's the url if it's not working?
rsx1

29.05.2014

Ort: -
Beiträge: 6
# 3 - 25.04.2014 um 20:02 Uhr

How this codepaste adapt for language change? Example: when I change to German language it takes indexgerman.htm file.
Chelrid

06.10.2016

Ort: -
Beiträge: 1170
# 4 - 29.08.2014 um 13:07 Uhr

Funktioniert das auch noch für die aktuelle 2011.4.4 Version?
smicroz

20.09.2015

Ort: -
Beiträge: 6
# 5 - 18.05.2015 um 02:01 Uhr

I lose my old account :(, but as update now work very well
test

10.05.2021

Ort: -
Beiträge: 1
# 6 - 10.05.2021 um 19:28 Uhr

test


Bitte Login benutzen, um Kommentare zu schreiben.