pluck
pluck 4.7 out now, download it today!

pluck support forums

for all your questions about the easiest CMS on the planet

You are not logged in.

Announcement

New registrations are disabled for some spam problems. New registrations will be avaliable soon. If you want to help to keep forum away from spam - contact us.
Please post your bug reports on Launchpad.

#1 10-07-2009 08:34:24

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

[Feature] Diffrent theme for every page

As in topic..... i see it in this way:

if there is a directory $themedirectory/theme then
in editpage must be option to chose file from this directory

Files can by named theme1.php, theme2.php....

when including content of page, see if there is variable $themefile (f.e) and including this file as theme.

This allow to manipulate the visibility avery page on site to have diffrent look. Diffrent look for blog, album, and others module...

A_Bach

Offline

#2 12-07-2009 15:00:59

Methuselah
Member
Registered: 14-03-2009
Posts: 63

Re: [Feature] Diffrent theme for every page

Just thinking about this - you could have the template names in the theme info.php - for example

<?php
$themedir = "thistheme";
$themename = "Best Design Ever";
$theme1= "Standard Layout";
$theme2= "Double Page Split";
$theme3= "Gallery Layout";
$module_space[0] = "main";
$module_space[1] = "footer";
?>

This is so theme templates could be easily identified in the CMS and would be easy to set up for theme makers.

Not sure how but if this feature was implemented it would also probably be a good idea for sub pages (gallerys and full blog posts) to maintain same template as their parent page.

Offline

#3 16-08-2009 11:56:57

adamu
Member
Registered: 16-08-2009
Posts: 25

Re: [Feature] Diffrent theme for every page

i would definitely like to see this as well. a few people have asked me for sites that can have different backgrounds and such  for each page and i'd love to be able to use pluck for them but haven't been able to!

Offline

#4 17-08-2009 11:10:50

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

adamu wrote:

i would definitely like to see this as well. a few people have asked me for sites that can have different backgrounds and such  for each page and i'd love to be able to use pluck for them but haven't been able to!

I'm working on it and its almost ready. I had only one problem- but... one problem is no problem smile

Offline

#5 17-08-2009 15:21:09

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

Done.

On page: http://www.pluck.ekyo.pl/en/5.Modules.php

you can find two links. multitheming and multitheming seo. Those files are not modules but modification - see instruction inside.

For those who want to do it allone - information here:

File index.php in root directory:

find:

	//Check which CSS-file we need to use (LTR or RTL)
	if ((isset($direction)) && ($direction == 'rtl')) {
		$cssfile = 'data/themes/'.$themepref.'/style-rtl.css';
	}
	else {
		$cssfile = 'data/themes/'.$themepref.'/style.css';
	}

Replace it with:

//Check which CSS-file we need to use (LTR or RTL)
$theme_css_name = 'data/themes/'.$themepref.'/'.theme_page_name();

	if ((isset($direction)) && ($direction == 'rtl')) {
		if(file_exists($theme_css_name.'-rtl.css')) {
			$cssfile = $theme_css_name.'-rtl.css';
		}
		else { 
			$cssfile = 'data/themes/'.$themepref.'/style-rtl.css';
		}
	}
	else {
		if(file_exists($theme_css_name.'.css')) {
			$cssfile = $theme_css_name.'.css';
		}
		else { 
			$cssfile = 'data/themes/'.$themepref.'/style.css';
		}
	}

Before:

//[THEME] FUNCTION TO INCLUDE MODULES

add:

//[THEME] FUNCTION TO SHOW THEME NAME
//---------------------------------
function theme_page_name() {
	//Get needed variables
	include('data/inc/variables.all.php');
	include('data/inc/variables.site.php');
	//Get the contents only if we are looking at a normal page
	if (isset($current_page_filename)) {
		//Check if page exists
		if(file_exists('data/settings/pages/'.$current_page_filename)) {
			include('data/settings/pages/'.$current_page_filename);
			return $theme_page_name;
		}
	}
}

Find:

//NOW, INCLUDE THE PAGE
//---------------------------------
//---------------------------------
include($themedirectory.'/theme.php');
?>

replace it with:

//NOW, INCLUDE THE PAGE
//---------------------------------
//---------------------------------
$theme_page_name = $themedirectory.'/'.theme_page_name().'.php';
if(file_exists($theme_page_name)) {
	include($theme_page_name);
}
else {
	include($themedirectory.'/theme.php');
}
?>

In data/inc/post_get.php

in part
//POST
add new variable:

$theme_name = $_POST['theme_name'];

In data/inc/editpage.php

find:

//Display checkbox for the hidepage-option
echo "<input type=\"checkbox\" name=\"hidepage\" value=\"no\" $hidecheck> $lang_pagehide1<br>
</td>
</tr>
</table>
</div>"; 

repace it with:

//Display checkbox for the hidepage-option
echo "<input type=\"checkbox\" name=\"hidepage\" value=\"no\" $hidecheck> $lang_pagehide1<br>
</td>
</tr>
<tr>
<td>
<img src=\"data/image/options.png\" border=\"0\" alt=\"\" \>
</td>
<td>
<span class=\"kop3\">choose theme</span><br>";

//Display choose for theme name
echo "<select name=\"theme_name\">";
$files = read_dir_contents('data/themes/'.$themepref,'files');
	if ($files) {
		natcasesort($files);
		foreach ($files as $file) {
			if (preg_match('/.php/', $file)) {
			$file = str_replace('.php', '', $file);
				if ($file !== 'info') {
					if ($file == $theme_page_name) {
					echo "<option value=\"$file\" selected>$file";
					}
					else {
						echo "<option value=\"$file\">$file";
					}
				}
			}
		}
	}

echo "</select></td></tr></table>
</div>"; 

Thats all smile

Offline

#6 21-08-2009 10:45:21

adamu
Member
Registered: 16-08-2009
Posts: 25

Re: [Feature] Diffrent theme for every page

excellent. i've replaced the necessary files and the dropdown for style on each page is showing up but there's no option for to choose the style i want

i just uploaded the new_theme.php into the main theme directory. am i missing anything?

Offline

#7 21-08-2009 12:49:45

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

adamu wrote:

excellent. i've replaced the necessary files and the dropdown for style on each page is showing up but there's no option for to choose the style i want

i just uploaded the new_theme.php into the main theme directory. am i missing anything?

main theme directory? wrong. Into your theme directory.

Instruction to use modification:
1. download file and replaced the necessary files.
2. Create new theme file and name it new_name.php - where new_name can by anything you wont (unless its info or theme - those two names are restricted).
3. You can also create new css file with the same name.
4. Your new theme file (ot both -  new theme and new css file) file put in your theme directory. If you use default theme - you will put those files in data/themes/default/
5. Now - edit page page you want to. Choose new_name before save button on editpage.
6. Go to page and your page (f.ex. kop4.php) should have new look.

7. If there will be some problem - mail me, or use contact form on my page smile

Offline

#8 21-08-2009 23:48:23

adamu
Member
Registered: 16-08-2009
Posts: 25

Re: [Feature] Diffrent theme for every page

awesome. much appreciated!

Offline

#9 23-09-2009 21:08:03

pabilo
Member
From: Netherlands
Registered: 23-09-2009
Posts: 5

Re: [Feature] Diffrent theme for every page

I tried this but i get the error :

Fatal error: Call to undefined function theme_page_name() in /var/www/index.php on line 363

i have made the changes and called my file new_theme.php in the directory
/var/www/data/themes/mytheme/

What did i mis ?

Last edited by pabilo (23-09-2009 21:08:34)

Offline

#10 24-09-2009 06:38:08

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

pabilo wrote:

theme_page_name

You missed theme_page_name function in index.php smile

There should be this function.

Offline

#11 24-09-2009 10:41:23

pabilo
Member
From: Netherlands
Registered: 23-09-2009
Posts: 5

Re: [Feature] Diffrent theme for every page

i used the changed version from your site:

http://pluck.ekyo.pl/downloads/pluck_4. … rls.tar.gz

changed like u sayed in the readme file

the admin works but the frontend don't

Offline

#12 24-09-2009 21:12:57

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

pabilo wrote:

i used the changed version from your site:

http://pluck.ekyo.pl/downloads/pluck_4. … rls.tar.gz

changed like u sayed in the readme file

the admin works but the frontend don't

This will work only if you are using also seo urls modification....

Could you post a link to site?

A_Bach

Offline

#13 25-09-2009 00:15:20

pabilo
Member
From: Netherlands
Registered: 23-09-2009
Posts: 5

Re: [Feature] Diffrent theme for every page

hmm problem is i don't have a web server at the moment.
i can give u screenshots if you want ?

-----

I found the switch case you made for someone else smile

That one works Great THNX big_smile

Last edited by pabilo (25-09-2009 00:40:42)

Offline

#14 07-12-2009 07:50:58

andyash
Member
Registered: 11-06-2008
Posts: 101

Re: [Feature] Diffrent theme for every page

Can you give me that switch case too? I'm facing the same problem on my local server as well.

Offline

#15 16-06-2010 19:16:06

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: [Feature] Diffrent theme for every page

I found small bug in multitheming module (for 4.6.x) where when you add f.ex. album module for a page where you choose difrent theme - album page will have default theme.

So i have fixed.

New files can be found on my pluck site.

A_Bach

Offline

Board footer

Powered by FluxBB