Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme custom template partial customization & load #1538

Open
rica-carv opened this issue Apr 14, 2016 · 11 comments
Open

Theme custom template partial customization & load #1538

rica-carv opened this issue Apr 14, 2016 · 11 comments
Assignees
Labels
topic: documentation type: enhancement An improvement or new feature request
Milestone

Comments

@rica-carv
Copy link
Contributor

As far i remember, in v1.4 it seems to have a partial template load ability, like it's yet present on the core download plugin download_template.php (i.e.: if(!isset($DOWNLOAD_CAT_TABLE_PRE)){.... )

As it is now in v2, the templates are searched or in theme or in the plugin itself, loading the first found and discarding the second, right?
This forces a theme custom template to have all the defines from the original plugin template.
I think of some drawbacks:

  • Plugin developer changes main template, making theme plugin will be not up to date
  • Duplicated code if theme designer only wanted to change one or two things, since it's forced to have all the defines duplicated from the original template....
@Jimmi08
Copy link
Contributor

Jimmi08 commented Apr 14, 2016

I am curious in this too. There is probably some setting I am missing. For example. With featurebox category template you can just rewrite/add new template in theme folder (not copy all file, just part of array you want to change). But with items - featurebox template - you need to include all original template file. Thanks

@rica-carv
Copy link
Contributor Author

@Jimmi08 In featurebox plugin, might be something in these files around these lines, perhaps?
e_shortcode.php (lines 346/350 & 433/449)
featurebox.php (line 58 - I can only see a require to the plugin folder, not to the theme folder....)

@rica-carv
Copy link
Contributor Author

Err, it seems getTemplate has a merge param.....

  • @param boolean $merge merge theme with plugin templates, default is false

Got to figure out how it works....

@Moc Moc added topic: documentation type: question An ask about behavior that is not found documented anywhere labels Apr 14, 2016
@Moc
Copy link
Member

Moc commented Apr 15, 2016

@rica-carv just fyi: boolean is true/false
Don't really know this specific functionality so I cannot be of more help here.

@rica-carv
Copy link
Contributor Author

rica-carv commented Apr 26, 2016

@Moc As far i've tested until now, if you just define a partial template on any template file inside a theme, only that definition is loaded from the theme, all the other definitions are used from plugins...
And this just by using a partial template definition inside a theme, nothing more....

@rica-carv
Copy link
Contributor Author

Well, i sung victory too soon....
After all, you need to have all the template definitions inside the custom template file inside the theme, or simply the template will be broken, since only the custom template file on the theme is loaded, and not the core or plugin template it overrides....
So, if there's any absent definition on the custom theme template, it will remain absent and will show simply nothing....

@Moc
Copy link
Member

Moc commented Feb 28, 2018

Is this issue still relevant?

@Jimmi08
Copy link
Contributor

Jimmi08 commented Feb 28, 2018

@Moc I haven't seen solution for this yet. If I want this: with custom plugin to add something to template without changing theme or core template. Before global variables could be rewrittten in plugin.

@Moc Moc added this to the Future milestone Feb 28, 2018
@Moc Moc added type: enhancement An improvement or new feature request and removed type: question An ask about behavior that is not found documented anywhere labels Feb 28, 2018
@Moc Moc modified the milestones: Future, e107 2.1.8 Feb 28, 2018
@Moc
Copy link
Member

Moc commented Jun 23, 2018

related to #3195?

@Jimmi08
Copy link
Contributor

Jimmi08 commented Jun 23, 2018

Yes, before you was able replace constants, now you can't replace method with template class/object or what is it.

@Moc Moc modified the milestones: e107 2.1.8, e107 2.1.9 Jun 25, 2018
@CaMer0n CaMer0n modified the milestones: e107 2.1.9, e107 2.2.0 Aug 22, 2018
@CaMer0n
Copy link
Member

CaMer0n commented May 4, 2019

@Moc

I have added tests for getTemplate(). e107inc/e107-test@022109c (there's still some refinement to do)

I believe that setting 'merge' to true by default (as well as keeping override=true as default) could solve most of the original issue mentioned above. ie. theme template keys would merge with existing plugin template keys. Any keys missing from the theme would be automatically filled by the plugin unless this feature is specifically disabled by the plugin. ie. By setting merge = false.

The ability for plugins to override core/theme templates is a separate issue and will need to be achieved another way (see #3195 e_template.php idea)

@CaMer0n CaMer0n modified the milestones: e107 2.2.0, e107 2.2.1 May 18, 2019
@CaMer0n CaMer0n modified the milestones: e107 2.2.1, Future May 27, 2019
@Moc Moc moved this to Backlog in Documentation update Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation type: enhancement An improvement or new feature request
Projects
Status: Backlog
Development

No branches or pull requests

4 participants