Joomla language switcher override - php

I'm trying to force the language swither module not to redirect to the home page if there is no menu item associations in Joomla 2.5.
I would just like to change country code in the current URL.
So that 'my-domain.com/en/menu?view=cat&id=1' translate to: 'my-domain.com/de/menu?view=cat&id=1' and so on ...
I guess I should modify modLanguagesHelper class but do not know how to create a required $language->link to work properly through JRoute.
Any help is appreciated!

Joomla usually does that by default. It seems strange that it doesn't with the approach you have followed.
Although, reading the comments you left, I understand it's not an easy task and you have already built quite a big part of the website, to go back to structure.
If I were you, I would write a small custom module to change the lang=xx or /xx/ in the URL, and redirect the user to the language they want. If you need help on that, feel free to comment below.
As per your question, I would personally go with simple string manipulation. Since you are really familiar with PHP (taking into consideration that you have written your own custom component), it should be a piece of cake for you, to:
Get the current URL
Get the current language tag
Replace the instances of lang=en with lang=de (example languages, you get the point)
Replace the instances of yoursite.com/en/ with yoursite.com/de/
Print the custom links, flags or whatever you are going to use.
It's not the suggested scenario, but you can really make a usable module if you also add:
An option for the administrator to write the language codes to use (to allow for later additions)
And make sure that you get the site name dynamically, and then you may also have a module that could be published in the JED to help others in the same situation like you!

Related

Would it be possible to create your own semantic markup "<something></something>" for you template engine in PHP?

I would really appreciate if anybody could help me with this question :)
I want to know whether it's possible to create your own semantic markup in PHP, just like BB Codes, but I want to be able to use it within my template engine system, so I could use it to call custom modules like voting system, adding comments, login form, registration form and so on...
Let me make it clearer for you guys of how I mean;
I'm working on my own CMS not to use it for production purposes but to learn PHP in a better way;
So I had this idea to call specific modules in a page based on their position and in order to be able to do;
For instance we're having a login module which is simply a login form, nothing too crazy, however you want to be able to include that module dynamically in any page you want using the backend and not touching any code;
So all you do in the template page is using my bb codes that I told you earlier;
Something like this;
Remember this is only an idea;
<zone name="left_sidebar"></zone>
And you add this zone markup on your sidebar and if any of your module supposed to be displayed on your left sidebar, it will just by having this markup and nothing more...
And you gone have loads of these semantic markups based on how many editable blocks you have on your page; so you could have one for the right sidebar, one for footer and one for header... etc.
So I now need to know how to could lookup for opening and closing tags, in this case it would be <zone></zone> , then it need to lookup for its attribute and its value, in this case name="right_sidevar"
....
Anybody have any idea of how I could possibly do this kind of thing...
Thanks in advance :)
You could check out TWIG; while it doesn't directly support this kind of feature (because it uses a special syntax for its own elements) it does have very good support for making your own elements, tags, sub-applications and other funky things in the backend.
http://twig.sensiolabs.org/
There are also a number of systems that perform this kind of task in the front-end; this would mean that the substitution is done by Javascript in the browser. In addition to the already mentioned Polymer, there's also Google's framework, Angular.
https://angularjs.org/
Maybe you can use php's libxml module to parse your xml file.

What mediawiki is need hook to write plugin which will add html just inside <body>

This question is addressed only to people having some experience in programming MediaWiki plugins.
I want to put some header at top of page with use plugin and html. I need to put some html code as the first tag after <body> opens to not but not know which hook or method should I use to achieve goal - Mediawiki has too much hooks to choose please suggest one.
http://www.mediawiki.org/wiki/Manual:Hooks
Result after plugin run should look like this:
<< Custom header>>
-----
<< Unchanged Mediawiki page >>
Could you help with this trivial problem?
One possible solution is to inject some JavaScript to create HTML but it is artificial and it will not work with Google Search Bot.
I think that many people want to put something on the top of their MediaWiki-s but without writing and maintain yet another skin or branching Mediawiki and it is supported today.
But if you think hooks is what you want, I'd go with ParserBeforeTidy. The hooks list is long but divided into sections, and "Page Rendering" is section you want to check. Parser(Before/After)Tidy are called on fully generated page, so they offer the highest degree of customization (which may be undesired, though).

Joomla article layout change base on navigation

I tried search lot on net but failed to got any solution.
Actually I want to change layout in my joomla article based on the user navigation.
For an example let say if user visiting iPhone Case studies & click on any case study(eg: Angry Bird) it contains the images/slideshow of angrybird project in iphone screen, while if the same article visit from iPad case studies page it contains horizontal image of ipad screen (Note: layout is changed).
To be short - I need the content & layout change in same article base on navigation or condition.
Is there any plugin or component which will help me to achieve this ? Any help will be appreciated.
Thanks
I think the easiest solution for this problem would be to use two different articles for each of the above said cases. That way you can easily style either of the cases the way you want. And by using one article for it, I see no particular advantage, as opposed to using different articles. If you see of any particular advantage please share it with us.
In any case if you want it to still use a single article, it seems to me that it would be a more complex solution. From what I know, there does not exist a plugin or component to cater your particular use case.
A quick and dirty solution, that comes into my mind includes the Jumi extension, which you can find here: http://extensions.joomla.org/extensions/1023/details . Jumi allows you to include PHP in your articles, etc..
You can then make an user-agent check and output everything as you need it for that particular device and for that particular article.
If you need different templates/layouts for both devices, I would recommend a theming framework, which does these things for you (applying different layouts for different devises). The T3 Framework from Joomlart does these things pretty well: http://www.joomlart.com/joomla/t3-framework-and-ja-purity-templates
I think the answer to your problem is 'Layout overrides'. Just create a layout override for the article component in the particular template folder you use for your inner-pages.
I think you should read through the following Wiki pages for a more clear understanding-
Joomla 1.5-http://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
Joomla 1.6(Should be applicable for 1.7 as well)-http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6
Hope that this solves your problem. Cheers.
I have seen another post here on Stackoverflow. Which says we can append page-class suffix to the tag. So as to style each article the way we we want, based on menu ids. This may be easier than a Layout override. Check out-
Joomla : How can we assign a different layouts to different menu IDs?

Magento Using all attributes within layered nav

I currently have a load of attributes already setup as text boxes - is there anyway I can get them appearing within the layered nav?
Any help would be much appreciated.
Regards
Shane
Given what you are looking for, Magento does not support what you want by default. However, the Magento filter code is fairly well structured, so this is something that you could add at will. The relevant backend code that will need to be modified is in the Catalog/Model/Layer subdirectory. Specifically, you will need to edit Mage_Catalog_Model_Layer to accommodate your new code. Also, you'll need to add a class that implements Mage_Catalog_Model_Layer_Filter_Abstract, to handle the actual filtering code. Finally, you will need to make the options appear on the frontend, which (in my cursory examination) will require two major changes. Firstly, you'll need to change the backend to allow the admin to mark text fields as being filterable, after which you'll need to modify the frontend template to display the checkbox fields.
This is a really significant amount of work. If at all possible, I'd recommend avoiding this route as it will also probably cause you significant problems down the road.
Hope that helps!
Thanks,
Joe
Right for anybody else looking at this, I looked into going down the custom code route, but quickly back tracked...
I decieded to bit the bullet, delete my attributes and recreate them and import the products again.

phpbb specific forum page styles

I am using phpbb on a site for a client, and the client has requested that each different forum page have a different background color.
Such functionality is not built into phpbb (from what I can tell), so how should I go about doing this? Can I modify the code of phpbb directly?
My other thought was to use a js conditional statement, but seeing as the only difference on the forums page would be the page title, I don't know how I could format this.
If you can include a js in a way that won't break when the software is updated then that would be preferable, using the forum id from the url perhaps?
Otherwise, this is a stab in the dark, but try this:
Find where phpbb outputs the <head>
Use a switch/case statement and output the necessary css based on the forum ids.
Document exactly where you made the changes, and remember that you may need to make them again when phpbb is updated to new versions.

Categories