• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

template-Weiche bauen - php

Yehudi

Guru
folgendende Stelle muss ich im Joomla firsieren, um mit netscape 4 ein anderes template aufzurufen:
Code:
/// loads template file
if ( !file_exists( 'templates/'. $cur_template .'/index.php' ) ) {
	echo _TEMPLATE_WARN . $cur_template;
} else {
	require_once( 'templates/'. $cur_template .'/index.php' );
	echo "";
}

Ungefähr so ähnlich müsste das dann aussehen:

Code:
/// loads template file
if is not nc4{( !file_exists( 'templates/mytemplate/index.php' ) ) {
	echo _TEMPLATE_WARN . $cur_template;
} else {
	require_once( 'templates/mytemplate/index.php' );
	echo "";
}} else{
if ( !file_exists( 'templates/netscapetemplate/index.php' ) ) {
	echo _TEMPLATE_WARN . $cur_template;
} else {
	require_once( 'templates/netscapetemplate/index.php' );
	echo "";
}}

Mit den Pfaden zum template ist das kein Problem, aber mit der If Regel, bzw die Abkürzung für den netscape 4 macht es Probleme. Ich hatte das auch schon umgedreht probiert, (also if nc4) funktioniert aber nicht.
 
OP
Y

Yehudi

Guru
Zwischenzeitlich habe ich was funktionierendes zusammengebastelt bekommen. Ist das vom Quellcode her korrekt, bzw. irgendwie verbesserungswürdig/fähig?

Code:
// loads template file
if (eregi('Mozilla/4',$_SERVER['HTTP_USER_AGENT'])) {
// Anweisungen fuer Netscpe 4.x.
if ( !file_exists( $mosConfig_absolute_path .'/templates/netcape_4/index.php' ) ) {
	echo _TEMPLATE_WARN . $cur_template;
} else {
	require_once( $mosConfig_absolute_path .'/templates/netscape_4/index.php' );
	echo '';
}} else {
// Anweisungen fuer alles andere.
if ( !file_exists( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' ) ) {
	echo _TEMPLATE_WARN . $cur_template;
} else {
	require_once( $mosConfig_absolute_path .'/templates/'. $cur_template .'/index.php' );
	echo '';
}}
 
Oben