Joomla 2.5 home page aliases - joomla

I want to access my website front page via aliases: http://mysite.com/some_alias_one and http://mysite.com/some_alias_two. Later I want to take some_alias_one(as well as some_alias_two) parameter in code and proceed further actions with it. In this case I do not need any redirection. If visitor comes with alias http://mysite.com/some_alias_one, so he must stay in home page with this alias without redirection. So then in my code I will check is user using alias_one or alias_two and depending to it I will do further actions (for example show some text or modules and etc).
So any ideas?

If I am understanding you correctly, there is a somewhat simple answer. Simply make 2 menu items that point to the same thing with different aliases. Since the menu items have different aliases, they will have different item IDs and you can assign different modules to each one. You can customize each page based on the modules you add to the page.
The only issue you will have is when a use goes to http://mysite.com - you will need to create a redirect that sends the user to one of the 2 aliases you have created. Either that or one of the 2 menu items will need to be set as the default.

Related

Joomla 3 Overwrite/Change "Menu Manager: Edit Menu Item"

Like the topic say I want to overwrite/change the "Menu Manager: Edit Menu item" layout. To illustrate my question:
In the picture whiche is shown I want to change the labels: Layout, Option, Integration.... and add some other options to it. How can I do it? Or is this even possible?
In order to change the text, simply use language overrides, google is your friend.
In order to add functionality, let's first of all explain what we're talking about to ensure we're on the same page.
Joomla components have views which can have one or more layouts, i.e.
/components/com_content/views/category/tmpl/ contains two layouts, blog and default.
A layout can additionally contain an .xml manifest (in our case, blog.xml and default.xml) allowing us to create a menu item for the specific view/layout combination. The .xml file contains the parameters that the user will set, you can add your own as well.
When you want to change Joomla, usually there is a way to do so without touching the core, which would be pretty bad, as any Joomla! updates would break your work.
For the view layouts a special feature called template override was developed, which allows you to create an alternative to the view layout in a safe place (under your template folder, in this case your admin template), and this is the most elegant and effective way to achieve your result.
Beware though, you are just creating a layout, most likely you will want to add functionality, if it's complex you might be better off creating a dedicated component to keep the code clean. Or you can just put all the logic in your view, query the database from there. But in this latter case, get paid, and run away. Never answer the phone to the customer again.
A final alternative is to write a system plugin that will manipulate the page markup after it was generated in the event onAfterRender(). This is a simple and good approach if you only want to add a button or make minor changes, but if you do anything more than that, see the above advise about running away.

Create another URL in Joomla 3 to same address

Is possible create a URL redirection in Joomla3 without extension/component?
For example, I have the URL:
mydomain.com/menu-alias/item
I need to make another URL to redirect to mydomain.com/menu-alias/item like:
/mydomain.com/short-url
Will I need some component/extension? or I can make it from Joomla3.
A common practice on Joomla for these types of "shortcut" URLs is to create a "Hidden" menu in the Menu Manager and simply create a menu item in that with the alias you desire.
If you decide to do this and you have multiple menu's linking to the same content I would strongly suggest that you decide which one is the canonical path and then make any other menu items of the "Menu Item Alias" type.
You can use the Redirect component.
See http://docs.joomla.org/Help33:Components_Redirect_Manager for details.

create dynamic template for joomla 1.5

there are tutorials on the web about gow to create index.html, css file and template.xml that contain placeholders. ok, i got it, it's simple. but i need a template that has some different views. for example:
-all pages have a topmenu, header, left sidebar, mainarea and a footer but:
-first page has no header .topmenu after which sidebar, mainarea and footer comes.
-second page has sidebar moved from left to right
-third page has four blocks (blocks for special offers) instead of mainarea.
as far as i can see, i need to create three standalone templates with unique set of placeholders for each template. because i can't see the way to change laarge mainarea placeholder with four placeholders for offers blocks on some pages. dynamically.
is there if-statements in joomla templates to simply determine a document id to view four placeholders instead of mainarea. or to not show header on the main page (f.e. doc. id="mainpage")
but i want it to be selectable like:
-this page has first case of that template (index_1.php)
-and that page has a second case of the same template (index_2.php)
like a selectbox.
is that possible?
I will make this an answer as opposed to a comment since I believe it will do what you are looking for.
Once your articles are setup and your links to them are established (the site has the info on it you're looking for), you can create the modules containing the data that you want shown from time to time.
Go to the module manager - on the right you should see 'module assignment' or something along the lines of 'display this module on the following pages'; you can then pick which pages you want the module to show on. You can specify all pages, none, specific pages, however you want.
This will enable you to show them only where needed however you like.
You can ALSO do this programatically inside the module (if you do custom HTML and use an extension like Sourcerer to add PHP to the module) with PHP should you want a little more flexibility, but just choosing the pages to show on should work for what you're doing.

Remove default nonexistent footer links

I have a problem with my MediaWiki installation on a local network. I'm using MediaWiki in German. There are several footer links in my wiki, that throw a 404 error. For example in the footer there's a link Impressum (in English: Disclaimer). It points to *NameOfMyWiki*:Impressum which does not exist.
When I go to MediaWiki:Disclaimers, then a Disclaimer shows up, it's the page that should be behind *wgSitename*:Impressum. I don't think it's intended that I have to point the disclaimer link to MediaWiki:Disclaimers.
Another behaviour that probably is based on the same problem is, that a user gets a 404 on his own user page, when the user page is still empty/not already created (clicking on the link on the top right next to settings). When another user edits the user page of the first user, the first user then can access and edit it, too. But not when it's still empty/not defined.
How can I fix that?
The text of the footer links comes from the interface messages MediaWiki:Privacy, MediaWiki:Aboutsite and MediaWiki:Disclaimers. To disable one or more of these links, set the corresponding link text to a single hyphen (-).
Alternatively, since MediaWiki 1.17, you can also modify the footer by defining a hook in your LocalSettings.php.
Ps. For anyone interested in going to all the way to the source, the code that handles these links is in the Skin::footerLink() method. The practice of disabling various interface features by setting the corresponding message to - is actually pretty common (though not universal) in MediaWiki; completely blank messages are treated a bit weirdly for historical reasons, so - is commonly used as a stand-in for "no value".
Edit: I just noticed that you were also asking a second question about user pages. To answer that question better, let me start by describing how MediaWiki should be treating non-existent pages:
When MediaWiki sees a wikilink (most, though not necessarily all, links in the navigation menus are also handled the same way) pointing to a non-existent page, it creates what is known as a redlink. These links are styled differently from normal links (typically they're colored red, hence the name) and point to an URL that looks something like this one, with the parameters action=edit (making it a special kind of edit link) and redlink=1.
When a user clicks such a link, MediaWiki first checks that the page hasn't been created in the mean time, and, if it hasn't been, that the user is allowed to create and edit it:
If the page exists, the user is just redirected to the normal view URL for the page.
If the page doesn't exist, and the user is not allowed to create it, they're also redirected to the normal view URL, which then returns an HTTP 404 status code and a message saying that the page does not exist. (This is what will happen if you click the "like this one" link above, unless you happen to be an admin on Wikipedia.)
Finally, if the page doesn't exist but the user is allowed to create it, MediaWiki just treats the URL like a normal edit link and shows the edit form.
It looks like, for some reason, new users clicking the link to their own user page on your wiki are hitting case 2 above instead of the expected case 3. This might be a user rights issue: in particular, you should check that normal logged-in users (group user) on your wiki have the createpage permission.
If you want to allow normal users to create only their own user pages, there are ways to do that, but all that I know of involve either installing an extension or writing your own getUserPermissionsErrors hook. I can give you some examples of how to do that if you want, but it takes a bit of coding.
Those links are placeholders that you might want to fill in. They are provided so you can easily fill-in some important parts of your new wiki.
See http://www.mediawiki.org/wiki/Manual:Footer for a complete list.
There is actually no setting to disable them.
The link mentioned by Ilmari Karonen above:
Alternatively, since MediaWiki 1.17, you can also modify the footer by
defining a hook in your LocalSettings.php.
...shows how to add links to the built-in list of footer links. What it does NOT show is how to remove the existing built-in footer links, which is what the original question was.
Turns out it is a simple addition to the referenced hook solution. You just need to discard the existing footer links in the template array.
Most folks will not only want to remove the built-in footer links but also add their own. In the spirit of StackOverflow, here is a complete example solution that does both (this is from an existing Wiki...)
This works in mediawiki-1.29.2 but it will probably work in many older versions too. Put this code in your LocalSettings.php file (I put it at the bottom) to remove the existing footer links and add your own:
# Remove all existing footer links and add my own
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
# IMPORTANT: this is the secret sauce - remove all existing footer links
$tpl->data['footerlinks']['places'] = array();
# To add new footer links to local wiki pages:
#
# 1) You MUST create your new pages in your (Main) namespace first, for example:
#
# http://<your-site>/wiki/index.php/About_Us
# http://<your-site>/wiki/index.php/Contact_Us
# http://<your-site>/wiki/index.php/Disclaimer
# http://<your-site>/wiki/index.php/Download
# http://<your-site>/wiki/index.php/Privacy_Policy
#
# 2) You MUST then create each of these pages in your MediaWiki namespace:
#
# http://<your-site>/wiki/index.php/MediaWiki:Aboutpage
# - Insert 1 line, with "About Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Contactpage
# - Insert 1 line, with "Contact Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Disclaimerpage
# - Insert 1 line, with "Disclaimer" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Downloadpage
# - Insert 1 line, with "Download" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Privacypage
# - Insert 1 line, with "Privacy Policy" (no quotes)
#
# 3) Add new footer links like this:
$tpl->set( 'aboutpage', $sk->footerLink( 'aboutpage', 'aboutpage' ) );
$tpl->data['footerlinks']['places'][] = 'aboutpage';
$tpl->set( 'contactpage', $sk->footerLink( 'contactpage', 'contactpage' ) );
$tpl->data['footerlinks']['places'][] = 'contactpage';
$tpl->set( 'disclaimerpage', $sk->footerLink( 'disclaimerpage', 'disclaimerpage' ) );
$tpl->data['footerlinks']['places'][] = 'disclaimerpage';
$tpl->set( 'downloadpage', $sk->footerLink( 'downloadpage', 'downloadpage' ) );
$tpl->data['footerlinks']['places'][] = 'downloadpage';
$tpl->set( 'privacypage', $sk->footerLink( 'privacypage', 'privacypage' ) );
$tpl->data['footerlinks']['places'][] = 'privacypage';
return true;
};
IMPORTANT: Don't forget to follow the instructions and create your own pages and the corresponding MediaWiki redirects, or your links may not show or they may be broken.

Custom options in Joomla! component help

I am building a module, or component not sure yet, but I need to have a some options that depend on another option. For example, if you choose "A" then options 1, 2 and 3 appear. If you choose "B" then 4,5 and 6 appear.
I can make everything appear at once just sending in the but can I make some params only appear after another is chosen?
Thank you.
This should be reasonably simple to achieve using javascript (i.e. it will run on the user's PC without a round-trip back to the server).
Put all the controls on the form, but for the ones that you do not wish to display initially use the CSS attribute {display:none} and they won't show.
Then use the onclick() event of the control which will determine whether other controls are made visible to show / hide controls as you wish.
There is an example of something similar to this (not within Joomla, but there is no reason (that I can think of) why this won't also work fine within a Joomla module / component) here: http://www.java2s.com/Code/JavaScript/Development/Makebuttoncontrolvisibleorinvisible.htm

Resources