Members: 16,996
Threads: 38,866
Posts: 159,475
Online: 50

Newest Member: Kl_broka@rediffmail.com


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etracker® Web-Controlling statt Logfile-Analyse

Go Back   Mambers.com > Development > Development Discussions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 15.08.2004, 00:17   #1 (permalink)
Mamber
 
Graemezee's Avatar
 
Join Date: May 2004
Posts: 78
Graemezee is on a distinguished road
Default Multi template hack (sub_template ) will it work in 4.5.1 beta 4

I found a hack that works well in a template I have been developing in 4.5(1.0.9) I am now redeveloping the templates for version 4.5.1

I have been looking at index.php and cannot work out where to insert this:

// akede,2003-09-14: Check the menu for a different template tag 'sub_template'
$menu= new mosMenu( $database );
$menu->load( $Itemid );
$params = mosParseParams( $menu->params );
$template = isset( $params->sub_template ) ? $params->sub_template : 'index.php';

// Make sure all content will be displayed in white layout
if ( $option=='content' && $task!='section' ) {
$template='index2.php';
}

if ( $option=='com_docman' || $option=='com_akogallery' || $option=='com_remository') {
$template='index2.php';
}
// End: akede


Can any on help with where it could be positioned to work in version 4.5.1
I have posted the whole hack below

Regards Graeme


http://forum.mamboserver.com/showthr...light=template
Alex Kempkins (akede) posted a solution for loading a sub_template during the testing of the alpha versions of 4.5. The solution uses the param field for individual menu items. For example if your template directory had three versions of your template's index.php with the names index.php, index2.php, and index3.php, you could...


Add a param for index2.php by entering this in the param field:

sub_template=index2.php

or to call index3.php

sub_template=index3.php

The code from akede below has been adapted for v4.5.1.0.2 and goes near the end of the main index.php in your MOS root directory. Below, look for the areas marked with the akede start and end comments. The balance of the code is for 4.5.1.0.2 and is for reference purposes only to show where the akede code goes:

code:

} else {

// akede,2003-09-14: Check the menu for a different template tag 'sub_template'
$menu= new mosMenu( $database );
$menu->load( $Itemid );
$params = mosParseParams( $menu->params );
$template = isset( $params->sub_template ) ? $params->sub_template : 'index.php';

// Make sure all content will be displayed in white layout
if ( $option=='content' && $task!='section' ) {
$template='index2.php';
}

if ( $option=='com_docman' || $option=='com_akogallery' || $option=='com_remository') {
$template='index2.php';
}
// End: akede

ob_start();
}
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); // Date in the past
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); // always modified
header( "Cache-Control: no-store, no-cache, must-revalidate" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header( "Pragma: no-cache" );

// akede,2003-09-14: Check the menu for a different template tag 'sub_template'
require_once( "templates/$cur_template/$template" );
// End: akede

if (!file_exists("templates/$cur_template/index.php")){
echo "Template File Not Found!";
} else {
require_once( "templates/$cur_template/index.php" );
}

if ( $do_gzip_compress )
{
//
// Borrowed from php.net!
//
$gzip_contents = ob_get_contents();
ob_end_clean();

$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);

$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);

echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack('V', $gzip_crc);
echo pack('V', $gzip_size);
} else {
ob_end_flush();
}

Not all menu items have a params field accessible from Admin. The Typed Content menu item is an example. However, a param field exists in mos_menus for every menu item, so you need to manually add the sub_template argument to the applicable records in mos_menus using phpMyAdmin only for those menu items without an Admin accessible params field. For consistency reasons, it would be nice to see the params field added to all of the menu item types.

The big advantage of this solution in lieu of using separate templates as indicated above is increased loading speed if most of the graphics remain the same because those graphics are already cached. For example, you might want to divide (or rather simulate dividing) your site into groups where you change a site name to reflect the current user community group.
Graemezee is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 15.08.2004, 04:01   #2 (permalink)
Mamber
 
rrhode's Avatar
 
Join Date: Aug 2004
Location: ontario, canada
Posts: 56
rrhode is on a distinguished road
Default Re: Multi template hack (sub_template ) will it work in 4.5.1 beta 4

holy man, that seems pretty cool. thanks for doing all that stuff. maybe one day ill understand it and then i can help. im workin on it.
rrhode is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 16.08.2004, 12:23   #3 (permalink)
Baby Mamber
 
Join Date: Jul 2004
Posts: 6
fred2bad is on a distinguished road
Default Re: Multi template hack (sub_template ) will it work in 4.5.1 beta 4

Yeah it looks cool.... even If I can't neither really undersatnd what it does. Did you manage to make it work with 4.5.1?
I would be really interested to know.

Keep going!!

fred
fred2bad is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi template with MambelFish laura Mambo 4.5 General Talk 1 17.05.2005 04:11
Javabean Backend Template Beta Release idigital Development Announcements 21 14.02.2005 01:02
Whats New in 4.5.1 Beta 4 stingrey Community Announcements 6 19.08.2004 06:55
[Hilfe] Template Hack Lockhead Templates 1 12.08.2004 20:05
Mambo 4.5.1 Template Competition... idigital Community Announcements 25 06.08.2004 02:09


All times are GMT +2. The time now is 06:48.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.