raja33 / carrington

Automatically exported from code.google.com/p/carrington
0 stars 0 forks source link

Patch Submission - Child Themes Capability #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a project that's going to require child themes and since I'd love to use 
Carrington core for 
this project I made a patch to the utility within core.

My solution is pretty rudimentary, it's basically overriding the CFCT_PATH with 
STYLESHEETPATH ( 
used for all non-child themes now ) and if no file exists then it uses the 
CFCT_PATH ( used for 
child-themes ).

This would allow for a child theme to override templates while utilizing the 
framework. For 
example, /header/home.php in the child theme would be picked up if the parent 
theme either had 
the same template or the default one (/header/header-default.php). 

If not acceptable please consider a solution or give me feedback in order for 
me to improve it.

Original issue reported on code.google.com by dancame...@gmail.com on 27 Aug 2009 at 8:45

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by alexking...@gmail.com on 27 Aug 2009 at 6:24

GoogleCodeExporter commented 8 years ago
This looks like an interesting approach. Perhaps you could create a 
proof-of-concept child theme (something 
very simple) that implements this so we can test it further before including it 
in core?

Original comment by alexking...@gmail.com on 31 Aug 2009 at 5:56

GoogleCodeExporter commented 8 years ago
Here you go, it's pretty straight forward but I added some comments within each 
template.

I used the carrington-blog as the parent.

Original comment by dancame...@gmail.com on 31 Aug 2009 at 6:46

Attachments:

GoogleCodeExporter commented 8 years ago
I tried to use this child theme here:
http://code.google.com/p/carrington/issues/detail?id=14

and I can't get my custom css to show.  I also need to know how to remove the
"functions work" text from the header.

Here is the style.css:

/*
Theme Name: Carrington Child Theme
Theme URI: http://smallbrewers.com/blog
Description: This is a child theme for CA Small Craft Brewers
Version: beta
Author: Dan Cameron/CatherineScholz
Author URI: http://catswebweave.com
Template: carrington-blog

Nothing special, just a child theme style sheet. Of course it still needs to be
loaded in a new default header.

*/

body {
    background: #fff;
    color: #000000;
    font: 14px/18px helvetica, arial, sans-serif;
}

On Nov 11, 8:54 pm, Alex King <alexking...@gmail.com> wrote:
> You may want to look at this:
> 
> http://code.google.com/p/carrington/issues/detail?id=14
> 
> 2009/11/11 Jesús Zuleta <jesuszul...@gmail.com>:
> 
> > Yes it the support child themes to create this css
> 
> > On Wed, Nov 11, 2009 at 8:53 PM, lstelie <lste...@gmail.com> wrote:
> 
> >> Hello,
> 
> >> Does Carrington Blog 2.2 support child themes ?
> 
> >> I tried it (to ease upgrade by separating my own modifications from
> >> regular files) and
> >> mychildtheme/header/header-defaulf.php
> >> doesn't seem to be taken in account
> 
> >> Thanks in advance
> 
> >> Luc

Original comment by catherin...@gmail.com on 19 Nov 2009 at 11:18

GoogleCodeExporter commented 8 years ago
@catherinesings The theme I included isn't for use, only for testing purposes 
for Alex and the team.

@Alex and the team - please consider including this into core in your next 
update. We're launching a major 
network -- today -- with this code. ( hint: om :) )

Original comment by dancame...@gmail.com on 20 Nov 2009 at 1:10

GoogleCodeExporter commented 8 years ago
This patch works well for allowing Child themes to override template files that 
already exist in the Parent theme. 
It does not allow Child themes to add additional template files that do not 
exist in the Parent theme.

We plan to address this issue in the next release.

Original comment by marlfo...@gmail.com on 30 Nov 2009 at 10:29

GoogleCodeExporter commented 8 years ago

Original comment by alexking...@gmail.com on 30 Nov 2009 at 11:16

GoogleCodeExporter commented 8 years ago
Do handle this properly is quite a bit more in-depth that I'd hoped, 
unfortunately.
To be useful in Carrington, the child theme feature should allow the child 
theme to
add various templates and have those templates be picked up by the Carrington
template selection engine. This means changes to:

- `cfct_filename()`
- `cfct_template_file()`
- `cfct_default_file()`
- `cfct_load_plugins()`
- `cfct_files()`
- `cfct_author_templates()`
- `cfct_cat_templates()`
- `cfct_comment_templates()`
- `cfct_filter_files()`
- `cfct_meta_templates()`
- `cfct_parent_templates()`
- `cfct_role_templates()`
- `cfct_single_templates()`
- `cfct_tag_templates()`

Basically, every reference to files and every interaction with the available
templates arrays will need to change. The available files needs to be a 
combined list
from the parent and child theme. Instead of having an array of file names, there
needs to be an associative array of file names with file paths as the value 
(where
the path = the parent or child file, as appropriate).

This is a worthwhile change to make, but it's also a fundamental change in how 
the
template selection currently works. It's likely the entire system will be 
rewritten
in order to do this cleanly.

Original comment by alexking...@gmail.com on 3 Dec 2009 at 6:57

GoogleCodeExporter commented 8 years ago

Original comment by alexking...@gmail.com on 1 Jan 2010 at 7:54

GoogleCodeExporter commented 8 years ago
I think we found a clean way to do this by changing only a couple of places in 
the 
code - see changeset:

http://code.google.com/p/carrington/source/detail?r=450

(which I wish I had committed separately now).

Thanks to Shawn Parker for his help in reviewing this approach.

Testing requested.

Original comment by alexking...@gmail.com on 6 Jan 2010 at 5:21