Demo

Give it a try
and play around
with ClanSphere
Demo

Codepaste - Details
Weitere Infos zum Codepaste

Name Template Switch in index.php
Autor de Jam2
CMS-Version ClanSphere 2011
Datei -/-.php
Date 2013-12-27 at 1:13 PM
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

Comments: 6
Page [1]
microz

2014-11-28

Location: -
Posts: 97
# 1 - 2014-01-17 at 6:37 AM

not works in my installation :(

update
Only works with mod_rewrite disabled.

Any sugestion?

Rgds


Last edited by microz on 2014-01-20 at 4:25 PM (Edited 2x)
Jam2 ClanSphere Team

2024-04-16

Location: -
Posts: 3377
# 2 - 2014-01-23 at 8:35 PM

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

2014-05-29

Location: -
Posts: 6
# 3 - 2014-04-25 at 8:02 PM

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

2016-10-06

Location: -
Posts: 1170
# 4 - 2014-08-29 at 1:07 PM

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

2015-09-20

Location: -
Posts: 6
# 5 - 2015-05-18 at 2:01 AM

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

2024-10-01

Location: -
Posts: 1
# 6 - 2021-05-10 at 7:28 PM

test


Please log in before writing comments.