Skip to Content Skip to Menu

Custom Template

9 years 10 months ago #255616 by tjohns92109
Custom Template was created by tjohns92109
I don't get this. I've searched everywhere and all I can find is how to create a new template inside the plugin/templates folder. Except for a lot of people complaining about the same thing.

So let's say I want to change the <h3> in the profile title to an <h1>. That's located inside the file, \components\com_comprofiler\plugin\user\plug_cbcore\cb.core.php. So how does creating a new template inside the templates folder do any good for something like that?

Then, let's say I want to alter the user list template... which I need to do. If I, for example, add a class to one of the divs inside the new default.php file in the new template, CB still uses the code from the default.php file inside the default template. And you can't unpublish that template/plugin in CB.

So I just don't see a way to customize the code in CB like you can using overrides with other components.

Please Log in or Create an account to join the conversation.

  • heyai
  • heyai
  • OFFLINE
  • Posts: 324
  • Thanks: 79
  • Karma: 24
9 years 10 months ago #255630 by heyai
Replied by heyai on topic Custom Template

hey-ai - the community for asian guys and non-asian girls

The search bar is your friend, not just decoration!

Please Log in or Create an account to join the conversation.

  • nant
  • nant
  • OFFLINE
  • Posts: 12339
  • Thanks: 1467
  • Karma: 877
9 years 10 months ago #255640 by nant
Replied by nant on topic Custom Template

tjohns92109 wrote: I don't get this. I've searched everywhere and all I can find is how to create a new template inside the plugin/templates folder. Except for a lot of people complaining about the same thing.

So let's say I want to change the <h3> in the profile title to an <h1>. That's located inside the file, \components\com_comprofiler\plugin\user\plug_cbcore\cb.core.php. So how does creating a new template inside the templates folder do any good for something like that?

Then, let's say I want to alter the user list template... which I need to do. If I, for example, add a class to one of the divs inside the new default.php file in the new template, CB still uses the code from the default.php file inside the default template. And you can't unpublish that template/plugin in CB.

So I just don't see a way to customize the code in CB like you can using overrides with other components.


Maybe this will help

www.joomlapolis.com/forum/6-news-and-publicity/227459-cb-203-template-css-overrides

Please Log in or Create an account to join the conversation.

9 years 10 months ago #255685 by tjohns92109
Replied by tjohns92109 on topic Custom Template
Okay... so it seems that creating a new template only gives you a way to edit css via overrides.css. Which can probably be done via the main CSS file in your template using '!important'.

So example.php (in the example template) is not editable I guess. And if this was 100% needed, might as well just edit the CB core default.php file and make a note of it so that you can re-implement the edit if it gets overwritten during an update.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48482
  • Thanks: 8283
  • Karma: 1443
9 years 10 months ago #255698 by krileon
Replied by krileon on topic Custom Template

Okay... so it seems that creating a new template only gives you a way to edit css via overrides.css.

Most of the files will auto inherit. For example you can override bootstrap.css and let the other files inherit from default. It's up to you.

Which can probably be done via the main CSS file in your template using '!important'.

No. Do not use important tags. They are only used as an absolute last result. For example CB has a few due to Joomla having aggressive ID based styling instead of using classes or elements. ID styles begin with 1000 selector weight so you need dozens of selectors or important tag to override them. CB uses classes and element selectors nearly exclusive. All you need to do is copy those selectors, put them in your override.css, change the style, and save. Due to load order your override.css styles will always take place with same or greater selector weight.

So example.php (in the example template) is not editable I guess. And if this was 100% needed, might as well just edit the CB core default.php file and make a note of it so that you can re-implement the edit if it gets overwritten during an update.

You can override the PHP file as well, but you need to change the filename and the PHP class names. However, my strongest advise is do not touch the PHP file. I can not possible think of a reason why you would need to modify the HTML structure that you can't do with CSS. When you override the PHP file it means you are no longer loading the default PHP file. This means when we make a bug fix to the templates PHP file you will not have the fix. When we add a few feature to it you will not have the new feature. In the future we'll have a better template system in place (frontend XML views like we use for backend) so this won't be a problem in the future.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: tjohns92109

Please Log in or Create an account to join the conversation.

9 years 10 months ago #255702 by tjohns92109
Replied by tjohns92109 on topic Custom Template
All good advice, Krileon. I appreciate it and will do what I can to find some CSS workarounds.

Thanks again!

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum