cotonti.com : page templates idea https://www.cotonti.com Последние сообщения в теме Cotonti en Sun, 14 Dec 2025 09:17:24 -0000 singh336 nice nice

]]>
пн, 02 дек 2013 22:23:03 -0000
Twiebie I already did just that a few days ago haha. :)

Here's the plugin if anyone needs it: http://www.cotonti.com/datas/users/pagetpl_897.zip

]]>
вс, 29 сен 2013 23:34:40 -0000
Macik #38050 Twiebie:

Pfff, I've had this problem with several client websites where I wanted to use the system category for multiple pages with different TPL's.

Glad I stumbled upon that bit of code, guys!

Thanks.

Make a simple plugin. hook it on `page.main`. Code it as follows:

if ($cat['tpl'] == 'system') {
  $mskin = cot_tplfile(array('page', $cat['tpl'], empty($al) ? $id : $al));
}

use templates named as: `page.system.#alias.tpl` or `page.system.#id.tpl`  (where #alias and #id is alias or id of corresponding page), located in standard page.tpl folders.

Note1: be sure to use alias if it exists for current page
Note2: be sure not to use special symbols in page alias that can not be used as file name symbols

]]>
вс, 29 сен 2013 20:47:02 -0000
Twiebie Pfff, I've had this problem with several client websites where I wanted to use the system category for multiple pages with different TPL's.

Glad I stumbled upon that bit of code, guys!

Thanks.

]]>
пт, 27 сен 2013 22:50:40 -0000
ez Thanks you all, it was a very fast idea..., and yes i do know that the code will break down, and that it was not perfect.... But this was all about the idea, and that came through, so mission accomplished (for my part). Now just the correct code is needed, but that can be developped fast i think....

]]>
ср, 02 ноя 2011 18:01:03 -0000
esclkm I think its good idea for little plugin)))

]]>
ср, 02 ноя 2011 17:55:19 -0000
GHengeveld I like your idea. Especially for 'system' pages this will be useful. Using page_text to insert the HTML is very dirty, inefficient and limited, so the addition of custom tpl files for individual pages is welcome.

Your implementation won't work (correctly), because it will break category tpl files. cot_tplfile will look for a template file matching page.myalias.mycategory.tpl, will probably fail, try page.myalias.tpl, maybe fail and finally return page.tpl. It will never look for page.mycategory.tpl anymore. You need an alternative approach. Try this:

if ($pag['page_alias'])
{
	$alskin = cot_tplfile(array('page', 'al-'.$pag['page_alias']));
	if (!strpos($alskin, 'page.al-'.$pag['page_alias'])) $alskin = '';
}
$mskin = ($alskin) ? $alskin : cot_tplfile(array('page', $cat['tpl']));
$t = new XTemplate($mskin);

Note that this is Siena code, not Genoa like yours, so you'll need to adapt it a little. I've also added the prefix al- to the filename to avoid confusion with category tpl files.

]]>
ср, 02 ноя 2011 11:50:36 -0000
ez @Dyllon: Its not about the page text, its about layouting the complete page  (So all fields...)

@Kort: Thanks, I think all designers will like this one... ?

I havent tried it YET with the page.edit.... stuff yet, But i can imagine that designers want to have that there too.. e.g. A FIXED page that should not have the Alias field and the delete option.  (This to prevent the client to either delete the page, or change the alias.... or any other fixed field.... )

]]>
ср, 02 ноя 2011 09:39:37 -0000
Kort ez: nice suggestion. i'd say it is far better than playing with alias-based conditions in a category tpl. in general, balancing between the number of templates and their "readability" depends on the project requirements and the skinmaker style, so i'm afraid there is no such thing as "ideal" here.

]]>
ср, 02 ноя 2011 07:14:46 -0000
Dyllon вт, 01 ноя 2011 23:06:50 -0000 ez If you do this (see below), it is very simple to make a separate TPL for a single page. based on the Alias.. This is a very minimal addition, but gives a great freedom with designing. I now have a page.[pagealias].tpl which i can use to design one single page :)

require_once $cfg['system_dir'] . '/header.php';

$mskin = sed_skinfile(array('page', $pag['page_alias'], $sed_cat[$pag['page_cat']]['tpl']));
$t = new XTemplate($mskin);

Hope this will help someone.. By the way it can be found in page.inc.php line 161 (around)

]]>
вт, 01 ноя 2011 20:40:34 -0000