Is overriding core code the same as overriding templates and layout files? - magento

Can anyone advise on how to override the core code?
Specifically this file:
vendor/magento/module-elasticsearch/Model/ResourceModel/Fulltext/Collection/SearchResultApplier.php
I've overridden templates and layout files in my custom theme, but don't know how to do the same for code files.
It's more the file structure I'm looking for I guess, but I also feel that overriding the code files is a bit more in depth.
Appreciate and help.
Thank you
Andy
I've tried mimicking the template, layout files but this method didn't work.

You can use di.xml for overriding any class and methods:
Please check below magento standard:
https://developer.adobe.com/commerce/php/development/build/dependency-injection-file/#override-a-method-using-preference-nodes

Related

Joomla 3 template override - can't find the right file

I am creating a Joomla 3 template
I want to do a template override for the category blog layout.
However, I can't seem to find the file that I need to edit.
I found the one for a single article page:
com_content->views->article->tmpl->default.php
I was expecting something similar for the category-blog layout but I can't find it!
Does anyone know which file I need?
Thanks
Try this:
components/com_content/views/category/tmpl/blog.php
or another files in that folder.

JOOMLA, Best way to make alternate layouts for articles?

I can't find a answer for this, I want to know what is the best way to have an alternative layouts for articles in Joomla.
If I understand you correctly you are looking for a way to create additional Alternative Layouts for articles. Under parameter tab "Article Options":
If that is the case, its very close to the other provided answers here. Its just that you got to rename the copied default.php file to something else. If you rename it to custom.php it will end up with the text "custom" like the image above.
Here goes my shot for a step by step:
Find the default layout file(s). You could use the ones provided by the com_content component. They can be found at components/com_content/views/article/tmpl. Copy both default.php and default_links.php.
Now you need to rename and copy the file(s) into a template. The target template can be any of the installed templates. Using beez_20 the new path for the copied file(s) should be templates/beez_20/html/com_content/article/custom.php and templates/beez_20/html/com_content/article/custom_links.php.
Goto to edit article using the backend. Expand the Article Options tab and find Alternative Layout. Select your new layout.
Your template might already provide a article override. If so, you might want to use the files of that template instead (instead of the ones in step 1). So if you are using beez_20, you could copy templates/beez_20/html/com_content/article/default.php and templates/beez_20/html/com_content/article/default_links.php.
Helpful links:
Using Joomla’s Template and Layout Override
Layout overrides in Joomla 1.6
The best way to do this would either to install another content component - such as k2 which is highly customizable. Or any other content component on JED.
Alternatively you could create a template override on the existing Joomla Template. This is preferable to editing the files directly in com_content component as the template overrides will never be overwritten whereas the core files will be in any Joomla Updates. I should add, hopefully unnecessarily that this requires Joomla 1.5, 1.6, 1.7, 2.5 or 3.0 (although this is still in beta as of present). So make sure you're not using 1.0.
To create an alternative layout for the built in articles component the best way to do it is probably to create a template over-ride.
See this article on docs.joomla.org on "How to override the output from the Joomla! core"
Creating an alternative for an article layout is pretty straight forward. You can achieve this by using the core layout override with your published template(s).
First you want to get/copy the core article layout file:
components/com_content/views/article/tmpl/default.php
Then place it into your published template:
templates/YOURTEMPLATE/html/com_content/article/default.php
If the template you are using doesn't have the html folder, then you will have to create that folder and each folder to make that path correct.
Once you have this in place, all you need to do is make changes to that default.php file you have just place in the template and that is it!

joomla autogenerated css classes

i want to make a new joomla template, i dropped into that but i am confused now.
i want to know where is the joomla autogenerated css class list.
for example i insert a module in template and what is the css class for example for menu title or the css class for search input box or what is the default css class for readmore link in main.
i found a little in joomla doc but i want the whole list
I fail to understand how you are prepared to make a Joomla template which is far more complex than a plain CSS template, yet you are unable to find the necessary CSS files. You said you wanted to make a new template therefore shouldn't you know where you have put the CSS file?
You are in dire need of Firebug for starters. Have a look at all it's features. It will help you to find CSS files and the specific line you need to edit.
I assume you are editing someone elses template in which case this is the sort of location you will be looking for.
templates/you_template/css/file.css
It varies with different template so I suggest you download Firebug as I suggested above.

Can I use CSS file extension instead of cshtml for the Razor view?

The idea is that I'm building a CSS file generating service, it's working just fine. But I need the view file extension to be CSS instead of cshtml so I take advantage of the visual studio intellisense.
Any ideas?
The only way I can possibly think this setup a custom HTTP handler; there you can give it an explicit name, and try giving it a file extension of CSS... Not 100% sure it will work, but you could give it a shot; though you would need to move the code to a class implementing IHttpHandler.
However, I don't think either way will work with Visual Studio Intellisense. If you want intellisense, add the CSS to the markup, then remove it programmatically at runtime. This is one possible way to work around it.
You could create your own ViewEngine which inherits from the Razor View Engine. There you'll need to set the FileExtensions property to include css. Here is a guide to creating it. The other option is to find the Razor View Engine from the View Engines list and try setting it there.

How can i make customized template for the front end by overriding the default one?

I am new to Pyrocms and reading the documentation I could not change fix my problem. I need my own template to be incorporated that is I want to change the default one provided. How can I do that. I really need a help.
Go into:
system/cms/themes/default/
This is the folder where you can find the default template of pyrocms. There you will see folders like "views, css, js, img" etc.
You can start by modifying views/layouts/default.html and views/partials/ folder.
Ofcourse if you need to change css and/or js you need to modify them too.
By the way this is the official pyrocms documentation for editing themes:
http://www.pyrocms.com/docs/manuals/designers

Resources