Cannot detect Frontpage properly in Joomla 2.5 templates - joomla-template

I've seen in Joomla documentation the way to detect if you are in Frontpage while creating a template in Joomla 2.5. This is the code:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
}
?>
This works when you are at home page (or clicking on Home menu), but I have an slider in home page, and I link in the slider to an article which is not in any menu item in the application. When I load this article the code above returns as I were at frontpage. I guess that if I doesn't click on any menu item, $menu->getActive() doesn't change.
Any suggestion?
Thanks in advance.

You can do one thing to solve this problem. Create a hidden menu of all the article links which are linked in the sliders.By creating hidden menu the link will be initialized and $menu->getActive() will work for all the links..Hopefully it will works for you .

I wish to add to the present answer and provide some clarifications.
In order for the menu selection to be detected the page requires to be assigned to a menu item. If this is a hidden menu than the link to such a page called My Page would be:
/index.php/my-page - “my-page” is the menu title alias for this item
However, if one wants to show the correct hierarchy in the breadcrumbs for the same page, then the menu hierarchy would have to be replicated in the hidden menu.
For example if My Page is under My Articles main menu item, then in the hidden menu you should add “My Articles” item, of the type: Menu Item Alias, which is in the Systems submenu of the menu type field. The My Page item should be a sub-menu item of My Articles.
The “My Articles” menu item in the hidden menu must have a different menu alias than the same one in the main menu hence the new link to My Page would look like:
/index.php/my-articles2/my-page
To create a hidden menu, one simply creates another menu. It does not matter whether one creates a module for it or not, but if one does then one just should not assign any position to that module.

Related

Custom or different URL path for menu item in Joomla 3.4

How can I change the URL path of menu item? For example I have menu like this:
- level_1
- level_1_1
- level_1_2
- level_2
- level_2_1
- level_2_1_1
- level_2_1_2
- level_2_2
- ...
and if I click on item level_2_1_2 I don't want to have url: /level_2/level_2_1/level_2_1_2 but only /level_2_1_2.
Is this possible?
Or can this be done in reverse, so I will have item named level_2_1_2 at the menu root so the URL will be correct => /level_2_1_2 but than menu items in the path /level_2/level_2_1/level_2_1_2 must have 'active' and/or 'current' class.
Thanks
Yes. This is very much possible.
Set up a second menu called "hidden menu" or something like that
Each item in your current menu needs to be moved to this hidden menu, without the nesting. Just add each item as top level without nesting.
Go back to your original menu and make them all "menu item alias" instead of "single article, etc..." And point to the hidden menu item that you established in the last step. https://docs.joomla.org/Help34:Menus_Menu_Item_Menu_Item_Alias
Done. Now when you click inside your nested menu, it's actually an alias link to your hidden menu which are all published as un-nested menu items.
Can probably be done by .htaccess too, but this is an easy way I have done it.

Shorten Joomla SEF URL Parent / Child / Sub Menu Items, Use only one alias without multiple parent alias

Is there anyway to only show the menu item alias in the URL without its parent alias? I know I can create a hidden menu with all items in the root level but this will make the breadcrumb unusable.
For example: www.mysite.com/grand-parent/parent/child
I like it to be just www.mysite.com/child
I have url rewrite/sef turned on using Joomla 2.5.
Thanks,
Will
There is a workaround.
Create a seperate menu and create menu item in that menu with required alias.
Then on the menu you want the link in the first place, create a menu item of type menu Alias and select the seperate menu item as target. This way parent alias will no appear infront for any alias type menu items.
No need for any workarounds. It works straight on.
(Written for J 2.5 but J 3 should be the same)
Choose the menu item which you wish to remove from the SEF URL (the parent menu which provides the url). Open it from the menu manager
In the section on the left, titled "Details" there is a row with "Alias". Next to it there's a button "Inherited". Click it so it becomes "Not Inherited".
Save & Close
Voila! It disappears .
It work's with "Direct Alias" extension.
http://extensions.joomla.org/extension/direct-alias
After instaling it "Inherited" button apears next to "Alias".
I have just had a similar problem and this plugin worked perfectly to achieve what I needed. This saves me hours of work creating 301 redirects. I had to buy the pro version to get the control over individual menu items. This gives you the functionality Ben Shomer describes above eg Next to it there's a button "Inherited". Click it so it becomes "Not Inherited". The free version controls ALL menu item aliases. Great plugin, highly recommended.
To perform what you want to do :
1- Install "Direct Alias" extension : http://extensions.joomla.org/extension/direct-alias
2- Go to "Menus" -> "All Menus Items" and select your menu item.
After "Alias" field you will have two buttons "Relative" and "Inherited".
Click on "Relative". It will transform to "Direct". Save and test.
You have now a direct link for your child item in your menu.
Note : If you don't install Direct "Direct Alias" extension the two button will not display.
I'm not sure it's possible with core Joomla.
You can achieve this - and complete control over your SEF urls - with the sh404 extension.
I solve it by following these steps.
Create a hidden menu which is your child menu. (For creating the hidden menu go to the Link Type tab and select No for Display in Menu option).
Then create your parent menu with a type of anything under the System Links (except Menu Item Alias)
Create a menu (as a child of the parent menu you have created before) with the type of Menu Item Alias and select the hidden child menu you've created before as the Menu Item.
That's all. Now you can show your menu structure like-
|-Parent
|--Child
And when you click on the Child link the URL will look like mysite.com/child

Prevent duplicate Jquery Tabs

I have links that when clicked loads the url as a tab in jquery. But when a tab already exist in the tab panel and the link is clicked a second time, i want the already added tab to be selected instead of adding a new tab of the same url.
thanks
Have you tried this way:-
OnClick of the tab, check if the tab id is already exists
If id is exists then add attribute as selected.

TYPO3: How to create a localization for page content element in list view?

I have non-used elements on my page. In list view I can see them. But now I want to create a page translation for this element. But in the list view there is no "Create new page translation" selection box. How can I create a localized element?
This is what I see? Where is the 2nd option?
In List module click the edit icon (pen symbol) of the content element. At the very top you will see a Language dropdown menu. Any language overlays that do not yet exist are marked with "[NEW]" (see Portuguese in the screenshot below). If you select one of those, the corresponding overlay record is immediately created and a you are presented with a form to fill in its content.

ASP.Net MVC - which is the best approach for multi select grouping using JQuery Dialog

This is my scenario
I have an view(page) with list of items, a user could select single or multiple items from this page and click on a "Add to Group" button. Then a modal dialog(JQuery dialog) will be shown, from that he could select group, then press the add button. Which causes the items selected in the parent page is added to that particular group.
So, which is the best way to pass the selected items to the modal pop-up?
Though the query string ? - what happens if the no:of items selected is large, will the url support that much characters
Keep the list in the parent page in a javascript variable and return the selected group from the modal pop-up?
Or is there is any other better option?
Thanks,
Rajeesh
2a. There is no "parent" page; modal dialog is part of the same page as selected items. Therefore on "OK" function from the dialog you can go through the checked items and do whatever you want, including POSTing to the server. It's not clear from your post whether "adding items to the group" happens on the server or client

Resources