GetSimple Support Forum

Full Version: page template changing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to set up something similar to what modx is doing where I have two page templates, and each has different template variables and gets rendered differently. (would be nice to have a separate link to create different page types)

I know this is outside of the scope of getSimple, but I think I can make this work.

As I haven't hacked the core or created plugins before I'm interested in hearing any feedback on how to make this work. For now I'm not looking to add a plugin, but rather just hacking the core.

The point is to be able to manage a list of items, and rather than creating a component, I thought I'd reuse the page structure.

I'm planing on using the custom fields plugin
- I'll add a dropdown for the page names
- might add a separate field, to be able to pick which page template is used on
- otherwise just hardcode it

then add some javascript on the edit.php page that simply hides all the fields that are not being used based on the selection of the template dropdown


If anyone has some suggestions, I'd be happy to hear them.
have you checked out specialpages plugin ?
Or dmMatrix

Never heard of modx b4

um this is fucking amazing

But the name is stupid, and the website is aweful, took me 5 minutes to find out wtf it was.
I love when designers over market something and entirely miss the point.
(2013-03-16, 05:14:50)shawn_a Wrote: [ -> ]have you checked out specialpages plugin ?
Or dmMatrix

Never heard of modx b4

um this is fucking amazing

But the name is stupid, and the website is aweful, took me 5 minutes to find out wtf it was.
I love when designers over market something and entirely miss the point.

Thanks

I've used a bunch of CMSes before MODx (evo) when I didn't know much php, like joomla and drupal, but found them too complicated and hard to customize without knowledge of php. When I came across it, I saw the way they did the templates and template variables system, it was so easy to extend the page to do what I wanted with little php knowledge. It has been my go-to CMS for a while, then I tried the updated (revo) version and had some performance issues. And then I haven't been using CMSes for a while after, and when I did I looked for something smaller, as I found myself thinking that these CMSes are a bit of overkill. So I've used GetSimple on smaller projects, but this is the first time I've needed to do something larger.

I have just came across the specialpages plugin, almost by accident, so now I'm trying to figure it out. I'm not sure where I can add the page templates. But it seems like this plugin was made to do exactly what I need, I just need to play around with it for a bit.
I do know phong and still ditched Drupal way too much work.
(2013-03-16, 09:37:27)shawn_a Wrote: [ -> ]I do know phong and still ditched Drupal way too much work.

I dont think thats the problem .
There is the choice for 'page template' and there is only 'standard template' in the box.
In gpeasy less then 4.31 ( github.com/oyejorge/gpEasy-CMS/releases )
this is possible with good knowledge of the menu.

Its just that one of the developers must do it.
Why are you necroposting and plugging gpeasy ?

asking for an instaban ?
(2014-11-18, 07:27:28)shawn_a Wrote: [ -> ]Why are you necroposting and plugging gpeasy ?
asking for an instaban ?

Dear Sir, i can understand Your separatism ....
its not a critics : The code of gpeasy (which needs sqlite...) is open.

The code of Lightneasy 322 is also open : Here i choose similar a new site and choose the template i want (example http://mb-info.eu/le322/ try the links in the heading).

Thats good for the entrance of a site and then to change the skin and the menus for individual sites depending upon the content.

But perhaps You know a php-code which i can insert in the code which determines the template. There is a themeswitcher-plugin which i can insert (as a tab). The code is open and so it might be possible to make a small plugin or an update of getsimple.

I hope to give You a small impulse for the next version.....
Not sure what this is really about, or what feature we are trying to accomplish.

You can already change templates in the page editor per page with the dropdown.

So I am assuming you guys want to change templates on the fly? Or have sub templates that work like modules?
(2014-11-19, 03:04:02)shawn_a Wrote: [ -> ]Not sure what this is really about, or what feature we are trying to accomplish.

You can already change templates in the page editor per page with the dropdown.

So I am assuming you guys want to change templates on the fly? Or have sub templates that work like modules?

When i got into the page editor then there is only PAGE TEMPLATE Default template (and no other) - and i have installed all SA plugins and i18 plugins . I want to be able to change the template for a site (and the menu for a site because of special content)

The only enhancement is with 'Admin Page Edit Dialog box enhancement ' which replaces editor.php, but then comes : header.inc.php footer.inc.php sidebar.inc.php as additional choice
Templates come from themes, some themes only have 1 template. If you want more, use a theme with multiple templates or copy the template.php and make your own variations.

Themes themselves are changed under theme tab


Sites have themes
Pages have templates ( from themes )


If you want "back end editor templates", then we do not do that, but you can use plugins like special pages and custom pages which allow you to add custom meta or additional fields which can be output in templates.


http://get-simple.info/extend/plugin/i18...pages/319/
http://get-simple.info/extend/plugin/customfields/22/
http://get-simple.info/extend/plugin/sim...-tabs/523/

Are the most common plugins to add custom page types with special inputs other than those provided in core.
Core does not support this.
(2014-11-19, 04:30:45)shawn_a Wrote: [ -> ]Templates come from themes, some themes only have 1 template. If you want more, use a theme with multiple templates or copy the template.php and make your own variations.

Themes themselves are changed under theme tab


Sites have themes
Pages have templates ( from themes )


If you want "back end editor templates", then we do not do that, but you can use plugins like special pages and custom pages which allow you to add custom meta or additional fields which can be output in templates.


http://get-simple.info/extend/plugin/i18...pages/319/
http://get-simple.info/extend/plugin/customfields/22/
http://get-simple.info/extend/plugin/sim...-tabs/523/

Are the most common plugins to add custom page types with special inputs other than those provided in core.
Core does not support this.

I copied header.inc.php -footer... - sidebar... and functions.inc.php to the equivalent header2.inc.php footer2... etc and copied the template.php to template2.php and changed there include('header.inc.php'); to include('header2.inc.php'); etc. That is a possibility but is all very awkward - Therefore, the core should be extended
Well there is no reason to copy them all.

you would use the same functions file, and header files

You would only change what you want, its your theme, structure it however you wish.

There are some hacks in the forum to switch the actual theme, so you can copy the whole folder and rename it, and its fairly easy to do with a pre-template hook and a global var.

I still have no idea what you are trying to accomplish, but it sounds like you not doing this the best way.

It is best to explain exactly what you want to do and, and someone will come up with a solution, or we will add a feature request.

perhaps you should read the theming section the wiki.
Well, the fact that you can edit themes, link pages to template files and create and edit components, but can't make the actual template files in admin, is a little awkward. It's usually not a huge problem doing things via ftp.

(2014-11-19, 04:30:45)shawn_a Wrote: [ -> ]http://get-simple.info/extend/plugin/i18...pages/319/
http://get-simple.info/extend/plugin/customfields/22/
http://get-simple.info/extend/plugin/sim...-tabs/523/

Are the most common plugins to add custom page types with special inputs other than those provided in core.
Core does not support this.

The second one should be this one (I think):
http://get-simple.info/extend/plugin/i18...ields/100/
(2014-11-19, 21:13:39)datiswous Wrote: [ -> ]Well, the fact that you can edit themes, link pages to template files and create and edit components, but can't make the actual template files in admin, is a little awkward. It's usually not a huge problem doing things via ftp.

(2014-11-19, 04:30:45)shawn_a Wrote: [ -> ]http://get-simple.info/extend/plugin/i18...pages/319/
http://get-simple.info/extend/plugin/customfields/22/
http://get-simple.info/extend/plugin/sim...-tabs/523/

Are the most common plugins to add custom page types with special inputs other than those provided in core.
Core does not support this.

The second one should be this one (I think):
http://get-simple.info/extend/plugin/i18...ields/100/

You misunderstood me a little bit. I copied the template to template2 etc
and can use any other template instead. It is just that i cant have 2 header.inc.php for 2 different templates , therefore header2.inc.php etc.

My proposal : First after Installation of 'Admin Page Edit Dialog box enhancement ' it was possible to see all files in a directory (before only 'Standard'.
If i choose a template2 (just any name) in the same folder which is 'not activated as standard' - then the path must be stored somewhere else..?. It would make sense to expand this module so that it is possible to go one level up to 'themes' and the down into a specific theme - the path must then be stored like ../xname/xtemplate - Can You tell me how and where it is stored at the Moment ?

At the moment i dont know how to link pages to template files by hand

What i was looking for originally was a function like
set_theme($theme, $persistent=false) which is in the theme_switcher(.php)-plugin
thern i intended to
<?php ...set_theme($theme-city, $persistent=true) ?>
which i can insert into the source-view of a new site -just the exact method - this is interesting for everybody
I still have no idea what you are doing.

themes/ <- themes go here
themes/themename/*.php <- templates go here

templates belong to themes
any file named *.php will display as a template option.
any file named functions.php will be automatically loaded.
.inc files are include files for template files to use , they will not show up in drop down, but will in theme editor.

The Admin Page Edit Dialog box enhancement plugin has nothing to do with templates, i have no idea what it does, something about file uploads.

again what does templates have to do with ckeditor image selection ?

If you want to change the actual theme on the fly, and not a template then modify the global
$TEMPLATE with the index-pretemplate hook
( you can use my hook_action plugin or a custom plugin )

Explain in exact steps what you expect to happen when you do x, and we will give you a proper solution, cause this is all wrong.
Also this plugin is not a valid plugin it will be deleted, this is a core file hack.
it is also for version 2.x
(2014-11-21, 04:18:50)shawn_a Wrote: [ -> ]The Admin Page Edit Dialog box enhancement plugin has nothing to do with templates, i have no idea what it does, something about file uploads.

I think with GS v2 it was not yet possible to browse for a file in the editor. Instead you had to go to the files section, copy the link, go to the editor and paste the url in the add url/image box. I think this plugin is a fix for that.

Boltz Wrote:If i choose a template2 (just any name) in the same folder which is 'not activated as standard' - then the path must be stored somewhere else..?. It would make sense to expand this module so that it is possible to go one level up to 'themes' and the down into a specific theme - the path must then be stored like ../xname/xtemplate - Can You tell me how and where it is stored at the Moment ?

Ehh.. you want to link a page to a template in a not-active theme?
That is what I am thinking as well.
It's possible same hook as above
Globals template and template_file
(2014-11-21, 20:35:46)datiswous Wrote: [ -> ]
(2014-11-21, 04:18:50)shawn_a Wrote: [ -> ]The Admin Page Edit Dialog box enhancement plugin has nothing to do with templates, i have no idea what it does, something about file uploads.

I think with GS v2 it was not yet possible to browse for a file in the editor. Instead you had to go to the files section, copy the link, go to the editor and paste the url in the add url/image box. I think this plugin is a fix for that.

Boltz Wrote:If i choose a template2 (just any name ) in the same folder which is 'not activated as standard' - then the path must be stored somewhere else..?. It would make sense to expand this module so that it is possible to go one level up to 'themes' and the down into a specific theme - the path must then be stored like ../xname/xtemplate - Can You tell me how and where it is stored at the Moment ?

Ehh.. you want to link a page to a template in a not-active theme?

Before i give it up... : I am new with getsimple and installed the newest version und installed serval themes by ftp and choose a standard theme.

I tried to choose a theme (or skin - just a name : the themechanger plugin says in the php $template=$theme...) for a new page like in some other CMSes.
But the choice was inactive - just 'standard'. When i installed the above 'Admin Page Edit Dialog box enhancement ' suddenly all files in the active folder were visible (try it with the portable Version ! if You do not beleive - i am not a php hacker but a user ! i have installe the i18 - plugins and the sa-plugins).
The systemchecker of getsimple says that everything is oK!)

So my first question was whether someone knows a solution with the themechanger - plugin or similar plugin - which i must insert (unfortunately) visible into a site - but i want to choose the theme or skin fixed for just one page and another theme for another page(like in some other CMSses standard).

If it is possible to integrate it visible into a site then it must be possible to integrate the function of that plugin when creating a new page by coping <?php ...see above.......?> into the head (ckeditor souce view).
Its similar as done with the 'search form' or with a 'contact form' - code.
I see no problem with that (maybe You dont want that).
getsimple only supports one active theme.

It sounds like you want to be able to pick per page, multiple themes.

Why exactly do you want to do this? Have different themes on different pages?

Normally you just use a theme with multiple templates like wide or sidemenu.

What are you trying to do?
How many pages need to be different from standard theme? One two?
Are you trying to have and external theme and internal theme for different users?

Do you know the themes you are going to use, have examples? Screenshots?

I have a solution that uses custom fields and hook_components plugins.

I still don't understand what these plugins have to do with this issue. Or what standard means?

Language barrier?
There are a bunch of ways to do this, but it depends on your situation.

For example a real quick hack would be
use a template in your theme to load a template in another theme.
PHP Code:
<?php

// template hack
// template_innovation.php
GLOBAL $TEMPLATE;
$TEMPLATE 'Innovation';

include(
GSTHEMESPATH.'Innovation/functions.php');
include(
GSTHEMESPATH.'Innovation/template.php');

?>

only problem with that would be core would still try to load functions.php in the default theme, unless you change $TEMPLATE in preindex hook instead.