• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Do your own editing (without a mess)

Rodolfo

⭐ Chevereto Godlike
Chevereto Staff
Administrator
I've saw a couple users (atually a lot of them) complaining about the hard work of installing a Chevereto update. Indeed is kind of hard and I was expecting to write this in the documentation but since the documentation is still not ready I will write a short guide in how-to customize this and not die trying.

First of all, an explanation on WHY.

Chevereto is separated in several layers of code. We have G\ in the most internal layer, then we have Chevereto core and then the theme system. Chevereto was designed to separate the core from the template so your changes must be at template level or at the controlled instances (routes and chevereto-hook().

If you have notice other systems use template systems or rely in system hooking to add customization layers on their apps. For instance OpenCart has something called VQMod which is a system that rewrites the source code, or you also have the XenForo system which I don't know how is called but is pretty much the same that VB, IPB, Magento, etc. does. The problem with these systems is that they use a lot of memory because each request must interpreter the theme file so they solved this adding cache but that is not the real problem, real problem is how you hook your changes.
For any of those systems you changes must be hooked in custom coding structures and that is a pain in the ass. So in Chevereto we do the same that they do in Wordpress but the difference is that in WP they hook a lot of plugins and the usage is pretty high, a single WP page load could take up to 20 MB memory while a Chevereto call takes only 1.3MB (average).
So if you want to be comfortable customizing (in the way of keep your changes) you will need to learn those coding structures and rely in cache. In Chevereto we don't do that, you only have to follow a method.

Ok, got it what now?

First of all, I recommend to only edit at the layers that are designed to be edited. Those are:
  • Routes (overrides)
  • Chevereto-hook.php
  • Theme
Please check this for further information on route override: http://gbackslash.com/docs

You can still edit any layer you want, is up to you. But keeping the system up to date will be a pain in the ass. So, lets talk about the theme editing.

Theme editing: You are doing it wrong.

Most of you work directly on app/themes/Peafowl and that is the first mistake. You should clone Peafowl into something like "MyTheme" and work in that theme. Don't touch Peafowl default at all if you want to heavy customize your theme (heavy means touch the HTML).

If you want to simply change the logo or customize the style or maybe just add footer or hader code refer to the app/content/themes/<mytheme>/custom_hooks folder.

Theme editing: Why clone Peafowl?

Because Peafowl is the default theme and that theme is always changing. So if you are running 3.1.0 and you want to update to 3.2.0 you will have a lot to think about in the weekend and probably you will be cursing me. By cloning Peafowl thing what happens is that you keep a record in what is going on.

Think in cloning Peafowl like this:
  1. Clone Peafowl into "MyTheme" (running i.e. 3.1.0)
  2. Make a lot of changes into "MyTheme" so 3.1.0 stock Peafowl is untouched.
This is the important part because, lets say... We want to update to 3.2.0, the steps should be:
  1. Download 3.2.0
  2. Compare 3.1.0 app/themes/Peafowl with 3.2.0 app/themes/Peafowl
Since you are comparing stock 3.1.0 default theme with 3.2.0 default theme you will notice exactly which are the lines that needs to be pushed and then you will be able to add this changes (if you need it) to "MyTheme".

Working like this keeps full or absolute control of the theme, system stability and you don't need to learn one single line of customized "Chevereto template syntax".

Required software

Obviously that you will want to use an automated software to spot the differences between the files. You can also do it manually but is the most inefficient thing in the world. I like a lot Winmerge (http://winmerge.org/) and here is a nice list with alternatives: http://blog.jardalu.com/2012/8/17/top_5_diff_tools

You need to just compare FolderA with FolderB and you will see all what is exactly changes from the moment that you forked Peafowl into "MyTheme" so took those lines and push them back to your theme.
 
I have to say that not cloning peafowl bit me in the ass during an upgrade. I had to go back and redo everything... But I don't think that you can stress enough that Peafowl default theme should always be kept static. Clone, clone, clone.

One thing I'm a bit curious about is why is the dashboard not semi-independent from the actual theme. It should really have a more static setting and not be reliant upon the actual forums theme (think WP).

Another awkward thing with editing is that a lot of the style is pulled from a non-theme .css file. I dislike how much is pulled from /lib/Peafowl/peafowl.css. I have to make sure to migrate the changes I make into peafowl.css into the themes .css which just creates extra lines of redundant code.
 
Last edited:
Another awkward thing with editing is that a lot of the style is pulled from a non-theme .css file. I dislike how much is pulled from /lib/Peafowl/peafowl.css. I have to make sure to migrate the changes I make into peafowl.css into the themes .css which just creates extra lines of redundant code.

That is because the default theme is based on Peafowl framework. Is the same thing when you base your web in Bootstrap. You don't touch the framework CSS, you do your own thing at your end. If you need to overwrite something then you overwrite something in your end, you don't touch source css.

Bottom problem here is that most of you are not used to work with framework base and you are not used to customize code. For example, Chevereto is based on PHP right? But you are not seeing me touching PHP core even when there is countless functions and methods that doesn't work as you should expect. So what I did? I wrote my own functions or methods based on PHP and I pull them into my app (Chevereto or G\). So this is the same thing, you are working in something that is based in something else so the thing that you do is not touch the base, you edit the outer layer.

Like I said, if you want comfort you have to sacrifice easiness and system performance and that is a really hard sacrifice. All that you need is to be ordered and wise, this method even allows you to have a complete different theme, 100% different, even without Peafowl because this system is backend + frontend and you can unplug the default front-end.
 
Last edited:
I think it's good that you added this topic, but I'm still missing instructions on what you mean with:



What exactly does this file do?
Ir allows you to add code and hook the handler. Look at app/loader.php at the bottom.
 
Back
Top