Remove default nonexistent footer links - user-interface

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.

Related

Joomla 2.5 home page aliases

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.

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.

How to exclude amazon.com from a Greasemonkey script?

I've a specific Greasemonkey 1.8 /Firefox 20 script (Auto-view spoiler boxes) that works great on most sites,
but on amazon.com it destroys the layout.
I've tried to exclude amazon.com in the script settings, but it does not work.
Since amazon.com defaults to https:// I've set the exception like this in
User Script -> Auto-view spoiler boxes -> Options -> User settings:
Include Pages:
*http://*
Excluded Pages:
*https://*
Yet, the script still does work on every website (yes, I've cleared the browser cache).
On the script settings tab, the non-editable Included Pages section contains:
http://forums.kingdomofloathing.com/vb/showthread.php*
What I'm doing wrong? How to exclude amazon.com from a Greasemonkey script?
Reference the include and exclude rules for Greasemonkey.
Don't use *http://* or *https://* the leading asterisk will yield unexpected results. Also not all Amazon pages use https.
In the user settings, you can use
http://*
for the Included Pages and these four lines for the Excluded Pages:
http://amazon.com/*
http://*.amazon.com/*
https://amazon.com/*
https://*.amazon.com/*
Or,
Erase all those user settings entries (the following won't work if you don't), and then use the Edit this User Script button/menu to change the script's metadata block to:
// ==UserScript==
// #name Auto-view spoiler boxes
// #namespace http://userscripts.org/users/75549
// #description Lets you skip clicking the Show button to view spoilers
// #include http://*
// #exclude /^https?://.*amazon\.com/?/
// ==/UserScript==
this lets you use Greasemonkey's regular expression matching to block all common Amazon (USA) addresses with one line.
Finally, not that it is best to avoid scripts that run on every page (http://*, etc.). You'll have a faster, smoother experience if you just include the select pages where spoilers are an issue for you.

How can I preview Virtuemart2 Order verification email layout changes?

I am trying to change the layout ( css/html structure) of Virtuemart 2 order verification emails. Problem is that I have to make a fake purchase each and every time I do a change in the 10 different files (located # components/com_virtuemart/views/invoice/order/tmpl) that create this email template.
The closest "preview" I got was this direct access url "http://domain.com/index.php?option=com_virtuemart&view=invoice&layout=invoice&format=html&tmpl=component&virtuemart_order_id=1401"
But again it loads Joomla's head/body elements not the actual email template.
So how can I have a "preview" of how the template looks like with my new changes BEFORE make an actual test purchase? Is this possible?
You shouldn't change the core files otherwise the next update of VirtueMart (of which there are many) will erase your changes.
You should use Joomla!'s template overrides which VM2 supports that way you can update as needed to new versions without loosing your changes. See this article on docs.joomla.org on "How to override the output from the Joomla! core" and this one on template overrides.
3. You need to add the &format=raw at the end of the link to retrieve just the output of the component with out the template/html body wrapped around it. Of course that relies on the component as well.
I was going to suggest using raw, but looking at the current VM2 it doesn't properly support the format=raw option. Looking at the mail layout in the invoice view it not structured to return it the way you expect, it actually generates a HTML version by default with a matching text only version.
The best I could come up given those two options
Return a close equivalent of the HTML email
http://domain.com/index.php?option=com_virtuemart&view=invoice&layout=mail&virtuemart_order_id=1401&tmpl=component
Return the text version, albeit wrapped in the html page... you may have to view the source to see your invoice text.
http://shop.craigphillips.biz/index.php?option=com_virtuemart&view=invoice&layout=mail_raw&virtuemart_order_id=4&tmpl=component

loading content on separate page that's encased in the jcycle plugin

So I have a website that has just two pages. On the home page, there are some things going on, but are not important. There are some links, however, that will need to link to a specific piece of content on the second page.
On the second page, I have content on there and it's all encased in the jcycle plugin.
What I need to do is if someone is on the homepage and they click on a link, it needs to load up the second page and show the correct "slide" that corresponds to what the homepage link is.
If you need any more clarification, please let me know.
In the cycle options reference, I see that there is a startingSlide option. You could set that dynamically. You could either do it with server-side code, e.g. /foo?slide=3 or you could check which anchor reference was used on the incoming link, e.g. /foo#slide3. Or, you could use DHTML to build the slideshow on the homepage when they click the given link.
Also note that there is a slideExpr option that you could use to filter the slides to a smaller set, depending on what they selected.

Resources