Joomla custom Template Override not working - php

I want to use a template override for Articles in Joomla, therefore I am using
mytemplate/html/com_content/article/default.php
If I change anything in this file the changes do appear.
But as I want to use an extra .php-file f.e.
mytemplate/html/com_content/article/alternativeLayout.php
I am facing a problem. Because although I can select this layout on the article settings page - any Changes I make do not appear and still the default.php is used.
Any ideas what I am doing wrong?

In order for an alternative layout to be used, two conditions must be met -
You must select the layout in the article parameters
No menu item can exist for this item - the layout selection of the menu item will override the selection in the article parameters
It sounds like your problem is with #2.
EDIT
Duh, I missed the key part of using alternate layouts. In order to be able to use an alternate layout with a menu item, you have to create an alternatelayout.xml file and place it in the override folder. This will give you an additional menu item option that you select when creating your menu item. You should be able to copy the defailt.xml file and edit it for the new layout.

I created a visual tutorial for this as it was driving me mad for about two days until I figured out how to actually work it. You can find it here: Joomla custom article template
I hope it helps others solve this faster than I did :-)
PS: all the credit for the article goes to Brent!!

the name of the files must be the same. The override must have the name "default". So its:
/yourTemplate/html/com_content/article/default.php
/yourTemplate/html/com_content/article/default.xml
/yourTemplate/html/com_content/article/default_links.php
had exactly the same problem, this solution solved it.

Also, note that any override filenames must be lower case. For example, "AboutPage.php" won't work.

Related

Position sort not working on product listing page magento2

this is category admin section where I have set products position.
But not showing correct order on category page.
Mageplaza_LayeredNavigation was causing issues for my website too, so I have changed the text relevance to position in the below file path.
/var/www/html/thinopticsnewdesign/app/code/Mageplaza/LayeredNavigation/Model/Resource/Model/Fulltext/Collection.php
and everything seems fine now, position sorting gets started working.
There can be different problems in relation to this. Probably some module overwrites the category page, so the ordering is not as expected.
If you installed some custom modules for the category page, I suggest to disable it, clean the cache and see if the sorting is okay after.
If you are unsure, you can also see the documentation page and if there are some extra options on this page (maybe some other module added that option).
Other than that, there are many other things that could cause this problem. For example, your theme overrides the sorting.
In my case, extension "Mageplaza_LayeredNavigation" was making this issue.
I disabled it and products start rendering with the assigned positions.
Thanks,

more than one text separator style per template in joomla 3.0

Let me first explain what I am trying to do.
In joomla 3.0 I have created a Menu_Item_Text_Separator override for my template http://docs.joomla.org/Help30:Menus_Menu_Item_Text_Separator. It seems as though joomla will only recognize one default Text separator per template which is ok if you just want the one. but I ideally would like to have the choice of selecting the custom one in my template folder as well as the default one that joomla recognizes. To inform you this is what I have done to make it happen.
in my template I have a folder named html which had a folder called mod_menu inside it.
In the mod_menu folder I have the .php files called:
default_separator.php
custom_separator.php
I then go into menu manager and edit the menu item for which I want to display a text separator for.
I then go to 'template style' http://docs.joomla.org/Help30:Menus_Menu_Item_Text_Separator and look for my custom style. but I only can choose the default one.
So i wonder if this is way that joomla works that you can only have one default per template. but is it possible to have more than one?
any advice most welcome.
regards
w9914420
Sorry this got too long for a comment.
Okay let's start from the beginning. Templates have a set of parameters defined in the templateDetails.xml file. A template style is simple a record containing the information about a template and the array of parameter options you have selected. You can make as many template styles as you want for a given template Each one has its own name. In the menu you can select any of the styles and assign it to a menu item. ....
What you are talking about has nothing to do with template styles. You are talking about using a layout override for mod_menu. Because you are using a file with the same name as a core layout file you should get a 1:1 replacement.
From what I understand of what you want to do, you should instead make a new named replacemen both for default_separator and for default.php. THat's because the alternative layout field is going to look for a replacement for default.php say yourname.php and then in that replacement when you load a template called separator it is automatically going to look for yourname_separator rather than default_separator because it assumes you are appending the _separator to the base name. If you do this it has some advantages such as you will be able to make a more complex layout and it will allow you to load different sub layouts conditionally for example.
I think your are confusing template styles with the style for menu module. Unless you have a parameter in your template that specifies the choice of a mod_menu layout a template style is not going to help you.Go to he module manager and pick the module you want to apply the style to. Use the field to select the layout you want. Or if it is a css style use the style option. It could also be that what you really want is to apply module chrome. THat do can be done by editing the module. If you want to have the same menu with different layouts or styles you'll probably want to make additional modules for that menu.
I had a rethink of what i was trying to do. What I was trying todo could not be achieved through the method I hoped - creating a template for that one text separator would not be practical although I have now discovered how to feed template parameter values into layout overrides.
Thank you Elin for your time
regards w9914420

How to create a submenu in Joomla! frontend

What I'm trying to do is create a submenu (in Joomla! backend) with below code but it does not work.
JSubMenuHelper::addEntry(JText::_('test'), 'index.php?option=com_test&controller=test', $controller == 'testcon');
I have attacted a sample pictures here. It explains what type of menu I want.
sample menu is here. check this picture
Thanks!
JSubMenuHelper is designed to be used in the Joomla! Administrator section, it's not made for the frontend.
If you really want to get to it, you need to include the file:
/administrator/includes/toolbar.php
Also you will have a bunch of missing CSS (js maybe also) files that you also need to include (form the admin template folder)
But I see no reasons what you want to use JSubMenuHelper in front-end. I would strongly advise against using it.
You should create menu and (submenu) in Admin Panel, but I think you already know that :)
Later you add look and feel with CSS.
I think you should do ti with CSS not PHP.

URLs for Joomla Component

I have created a simple basic component in joomla named, careerform so I want to know that what will be its url? Will it be :
index.php/?option=com_careerform
or in sef it will be something like:
index.php/components/careerform
or it will be like this while using .htaccess
/careerform
Is it true or what are joomla default URLs with different settings? Please tell what you know.
thanks for your time.
While what you are asking to do is possible, it would be rather complicated to rename a component. As part of the renaming you would have to update the names of dozens if not hundreds of classes throughout every file of the component. Very likely to run into some bugs because of this.
The far easier prospect is to just avoid these types of urls in your site. Joomla will only fall back to that style of url if a menu item does not exist for the view. Because of that, you can make the url into this:
http://sitename.com/any-component-alias/
To do this, go into the menu manager and create a new menu item. If you don't want this as part of the main menu, you can create a new menu. (I typically have a menu called "Hidden" for menu items that I want aliased but don't actually link to throughout the site from a menu.) When creating the menu item, make sure the type matches the component and view. The alias will then be whatever is entered in the alias box just below the title.
The one issue you may run into with this is that a component may not have a menu type for a particular view. In that case, you you would need to add the necessary metadata.xml file to the view (which again would be much easier than renaming the component!). A good tutorial for that can be found here: http://docs.joomla.org/Adding_view_layout_configuration_parameters.
yes if SEF will be enabled then index.php/component/careerform will be used.
You can create custom URLs by developing a router for your component.
There is very good documentation for it here.

Drupal Views Automatic Filter

I was just wondering if there was a super quick way to automatically add a filtering system into Drupal views.
I.e. I just need to add in the top of my view search by name (text box) and search by category (drop down box)
Or do I just manually create this form then use the filter agruments within the edit view screen?
I found the answer.
It's part of the Views Module under filters - then you just expose them, simple...
Not sure what Daniel was on about?
I dont understand exactly you question, but have you tryed VBO?
However, when you create a view you can 'expose' the filters you use, so the user can change it in the view page.

Categories