I could not find any info on overriding a Joomla plugin in my template.
Some forums claimed there was no plugin override, and the Joomla documentation (being the menacing forest that it is) either has nothing on the subject, or the page is hard to find.
So how can we override the output of a Joomla plugin in the same was we override the output of com_content or mod_contact?
I have found a way to do this:
Navigate to <joomla_homefolder>/administrator/language/<your_language>/
Search for the plugin's corresponding language file.
Copy the file name, EXCLUDING the language prefix (ie en-GB.) and the .ini suffix.
In your template create a folder named html (a common practice for template overrides).
In the html folder create a subfolder and name with the language file name as you copied it in step 3.
Navigate to the tmpl subfolder in the plugin's path: <joomla_homefolder>/plugins/<plugin_type>/<plugin_name>/tmpl
Copy the view file you wish to override into the folder you've created in step 5.
Modify the copied file to override the plugins output.
For example -
To change the page navigation buttons - modify the output of <joomla_homefolder>/plugins/content/pagenavigation:
Go into <joomla_homefolder>/administrator/language/en-GB/ and find the file named en-GB.plg_content_pagenavigation.ini.
From the filename copy only plg_content_pagenavigation.
Create a folder named html (If it does not exist already) in your theme, inside it create a subfolder and name it plg_content_pagenavigation.
Copy the view file <joomla_homefolder>/plugins/content/pagenavigation/tmpl/default.php into the plg_content_pagenavigation folder you just created.
Modify the file.
Note: I have tried it only with Joomla 3.1.
The method may not work with some plugins.
Good Luck.
In joomla 3 you can override plugins output only, that's why the origin plugin must be implemented with a tmpl.
The naming convention of the folder in you [template]/html is
plg_[type*]_[pluginElement]
Template overridden native joomla plugins is only the pagenavigation.
type* : obviously there's no sense to be other than content but if it's custom plugin no one can stop you.
On a Joomla 3.1 install, I am using the Simple Image Gallery plugin and I felt the need to override it in order to add extra functionality to each thumbnail of the gallery.
I copied all of the contents of <joomla_homefolder>/plugins/content/jw_sig/jw_sig/tmpl/ into the folder <joomla_homefolder>/templates/protostar/html/jw_sig/ and I was then able to modify both the default.php file for output modifications, and the accompanying template.css file for styling modifications. This successfully overrides the plugin's output without risking issues during future updates.
Of course, this will not work with all plugins, but it offers another alternative if you have a plugin that was nice enough to be developed with a tmpl folder.
No you can't override the same way because there is not tmpl folder because plugins really should not be rendering though of course a lot do. You probably need to clone the plugin and make a the layout your want possibly using a jlayout to make it easier to manage.
Elin's answer is not quite correct for Joomla 2.5-3.x. Some plugins do render screen output and have /tmpl folders that you may be able to override. See http://docs.joomla.org/Layout_Overrides_in_Joomla
In some cases you may need to create alternative views within the plugin /tmpl folder. For example, some of the simple, newer custom content components that use JForms let you add fields to com_content articles and select a view template for each field. Then overrides for com_content are generated dynamically to display the custom fields. Each field type can be displayed in the component area through plugins, or in a module, or within the template code, but it will use the /tmpl file you selected for the field in the CCK component. If there is a way to override the different field views from within the template folder, it must require an arcane menu structure I haven't been able to discover.
Related
I want to implement the feature for admins to set custom templates. Like they can place themes or templates in a particular folder relative to the home folder.
Each theme may have a folder and some config or preview for example(optional).
1) First I need to figure out how to set custom templates dir for an app.
2) Then I can probably do listdir and get all the folders and then give the admin an option to select the dir.
3) A setting list to specify additonal template folders by users.
1 is the problem.
The main question I want answer for is how to set custom template dir which can be modified anytime.
I found out that askbot (the SO clone) implements this kinda theming where you can place themes in subfolders a folder and the admin can select the folder which he/she wants the templates.
I am new to Django. I guess you can do it using jinja templating.
http://jinja.pocoo.org/
Add a common styling to one html page(base.html)
and then extend the base html to whichever pages u want using extends-- check out template inheritance in the above link
Also you can get some cool templates in bootstrap.. checkout their template section. https://www.w3schools.com/bootstrap/bootstrap_templates.asp
Good luck!
I created my own template named ibtheme, then I copy woocommerce folder from Woocommerce plugin to my template. But when I click on a product on frontpage, I see that it call the template files in plugins/woocommerce/templates/single-product, not from ibtheme/woocommerce/templates/single-product/
Please help me to override product page template!
Thanks advance!
As you have already discovered, you can edit the template files in an upgrade safe way through overrides. Simply copy it into a directory within your theme named /woocommerce, keeping the same file structure.
Example: To overide the price display template, copy: wp-content/plugins/woocommerce/templates/single-product/price.php to wp-content/themes/ibtheme/woocommerce/single-product/price.php
You can read the full documentation for WooCommerce theming at Template Structure + overriding templates via a theme
I would suggest that only copy/override the specific templates that you plan to modify. I've had to go through every single template to repair a broken theme/site after a major WooCommerce upgrade, so trust me, this will make it easier to upgrade WooCommerce in the future.
Noticed the template variable %%GLOBAL_HeadFonts%% in HTMLHead.html in the Bigcommerce Blueprint theme as well as other themes.
What I don't understand is where the value of this variable can be set in the Bigcommerce admin interface / back-end. I notice that theme authors seem to stick additional fonts directly into HTMLHead.html before/after %%GLOBAL_HeadFonts%%.
%%GLOBAL_HeadFonts%% is used to fetch the base theme's fonts. Since you have no control over any %%GLOBAL.something%% and %%LNG.something%% its better to call your fonts just under this line. You can upload your fonts by creating a fonts directory (under template) then call those fonts either within your Style.css or externally using %%ASSET.fonts/myfont.wof%%
Use this https://developer.bigcommerce.com/themes/panels/html_head to understand BigCommerce HTML.head architecture.
I'm developing my templates for Joomla and I'm needing to get the URL of the 'Featured Image' of an article. Is there a special Joomla PHP call to get this as a variable?
AFAIK, You cannot get this directly in the template's index.php file, but you can access it using the template's overrides. So start by creating a HTML folder within your template, then within that folder copy the folders you wish to override.
So for the image url, copy the following file
components/com_content/views/article/tmpl/default.php
to
templates/yourtemplatename/html/com_content/article/default.php
and then within that file you can access use / access the image url.
See more: How to override the output from the Joomla! core
Simple answer is No, an Articles image and URL's values are part of the articles params and are stored as a JSON string. You can find more about accessing them in this answer
The article content (or main component content) of a page in Joomla is displayed by the component, so to display the article content in a custom way a template needs to create it's own overrides for each component or module that it wants to change the appearance of. This is what #mozami was talking about.
How do I customize an existing Dojo widget? I'm using dojo version 1.3. In the previous versions we had the html file under templates folder. Do I need to edit the source code directly.
I need to add an image to Accordion widget. Can someone please help me in customizing it?
Thanks in advance.
First, grab the existing template from the dojo library. This'll be your starting point.
Then, create your own widget that inherits from AccordionContainer, but specify your own html template:
dojo.declare("MyWidgets.Accordion", dijit.layout.AccordionContainer, {
templatePath: dojo.moduleUrl("MyWidgets","Accordion.html");
});
(dojo.moduleUrl is a nice way of specifying folder paths so the dojo library can find and inline them when you package up your final product).
This way, you leave the original source intact, but can set your own html and override any methods as needed.
That HTML template is still there in the templates folders. You just need to download the source release. Depending on your needs you could 1) set the content by adding children, 2) write custom widget inheriting it or 3) use it as a part of compound widget. Inheritance in Dojo way is simple:
dojo.declare("my.Accordion", dijit.layout.AccordionContainer, {
// your methods...
});
I think you could extend the existing widget rather than modifying it.