Skip to content
Snippets Groups Projects

Import wiki content about Smarty templating

Merged homotechsual requested to merge github/fork/seancolsen/wiki-templates into master

Created by: seancolsen

This PR imports the following wiki pages:

I would like someone else to review this before merging. Maybe you even want make some improvements to this PR yourself? That would be great because I'm likely to agree with anything you suggest. Also I'm fine with merging as-is.

Notes:

  • I think the level of quality for this content is a bit sub-par, but I don't feel confident enough in the subject matter to improve it myself.
  • For the most part, I kept my edits to formatting-only.
  • I put them all in one place, but I'm not sure this is the best way to organize this content.

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 # Customizing Built-in Screens
2
3 !!! caution "Use extensions instead"
4
5 The methods on this page are of historical interest and may be helpful in understanding legacy code, but overriding templates and php files is strongly discouraged for any new customisations. These approaches need attention whenever you upgrade and will cause a range of problems from subtle to major if you forget about them.
6
7 As CiviCRM evolves, the recommended ways of customizing it change. The current preferred method is to Create an Extension to implement Hooks and use the API. If you can't find a way to use existing hooks to accomplish what you want, discuss it on StackExchange or Chat. It may be appropriate to add a new hook to core.
8
9 (It is possible to override templates and php in an extension, but you face the same problems when it comes to upgrading - don't do it!)
  • mattwire
    mattwire @mattwire started a thread on commit ffa68553
  • 180 patch if you need to use a template that isn't yet complying. For more
    181 information about submitting a bug or issue, read about the CiviCRM
    182 community.
    183
    184 ## Displaying more content and adding Ajax features
    185
    186 If your modifications go further than "simple" modifications of the
    187 layout, but need to display more content than the one assigned to the
    188 template by default, or to add Ajax functionality, use the CiviCRM API.
    189 Please read more information about using the CiviCRM API from Ajax to
    190 pursue this approach.
    191
    192 In most cases, using the CiviCRM APIs should be simple and only takes a
    193 few extra lines of modifications.
    194
    195 ## Appending jQuery or other code to a template
    • Better to use hooks and CRM_Core_Resources::singleton()->addScriptFile here. Do we have a part of the docs that explains this?

  • Created by: seancolsen

    @mattwire would you be willing to make a new pull request with your suggested changes?

  • Please register or sign in to reply
    Loading