How to set up an accessible template switcher?
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
How to set up an accessible template switcher?
Hi Forum
Please forgive me if this is covered elsewhere and point me in the right direction?
On my site at http://disability-norfolk.org/ I've added a simple template chooser in the accessibility tools in the header. Thing is... it switches but then after it's switched, any clicked link reverts to the default template. I've used a simple link from the icons to (eg) /index.php/?template=ncodp-wht. I'm sure this is a bit simplistic but hey, I had to try it!
Can anyone suggest how to get it to play nice, please?
Please forgive me if this is covered elsewhere and point me in the right direction?
On my site at http://disability-norfolk.org/ I've added a simple template chooser in the accessibility tools in the header. Thing is... it switches but then after it's switched, any clicked link reverts to the default template. I've used a simple link from the icons to (eg) /index.php/?template=ncodp-wht. I'm sure this is a bit simplistic but hey, I had to try it!
Can anyone suggest how to get it to play nice, please?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
Hi Jim,
I use a trick for a permanent template switch.
Rename templates/[yourtemplate]/index.php to multimedia_index.php
Now create a new index.php in templates/[yourtemplate] with this code:
Now create an accesible version of your template called accesible_index.php.
You can change permanently the template using a link like "index.php?accesible=1" for change to accesible template or "index.php?accesible=2" for come back to multimedia version.
I use this trick for create several accesible versions of a multimedia template.
I use a trick for a permanent template switch.
Rename templates/[yourtemplate]/index.php to multimedia_index.php
Now create a new index.php in templates/[yourtemplate] with this code:
Code: Select all
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if ($_GET['accesible']==1) {
setcookie('accesible', 1);
$_COOKIE['accesible']=1;
}
else if ($_GET['accesible']==2) {
setcookie('accesible', 2);
$_COOKIE['accesible']=2;
}
if ($_COOKIE['accesible']==1) {
require(JPATH_SITE.DS.'templates'.DS.'[yourtemplate]'.DS.'acessible_index.php');
else
require(JPATH_SITE.DS.'templates'.DS.'[yourtemplate]'.DS.'multimedia_index.php');
You can change permanently the template using a link like "index.php?accesible=1" for change to accesible template or "index.php?accesible=2" for come back to multimedia version.
I use this trick for create several accesible versions of a multimedia template.
From the code to the reality!
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
Re: How to set up an accessible template switcher?
Many thanks, that's great. I'll try it
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
Remember replace [yourtemplate] for your template path.
Regards!
Regards!
From the code to the reality!
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
Re: How to set up an accessible template switcher?
Hi
My skill with php is not good. I tried your method but all I get is a few lines of code.
Can you show me the method in action please?
My skill with php is not good. I tried your method but all I get is a few lines of code.
Can you show me the method in action please?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
From the code to the reality!
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
Re: How to set up an accessible template switcher?
That's this topic?juanparati wrote:See: http://forum.joomla.org/viewtopic.php?f=428&t=377667
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
Sorry!! A cut and paste error!
From the code to the reality!
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
Re: How to set up an accessible template switcher?
So, can you show your method in action, please?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
-
- Joomla! Apprentice
- Posts: 7
- Joined: Wed Jul 16, 2008 3:59 pm
Re: How to set up an accessible template switcher?
Jim
Did you resolve this?
Tony
Did you resolve this?
Tony
-
- Joomla! Enthusiast
- Posts: 230
- Joined: Mon Apr 10, 2006 12:15 pm
- Location: Cromer, Norfolk, UK
Re: How to set up an accessible template switcher?
I'm afraid not, Tony,
I had to pass the job over and lost track of it. I'll ask the new administrator how they got on and post any news here.
I had to pass the job over and lost track of it. I'll ask the new administrator how they got on and post any news here.
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed
Only exact urls allowed
-
- Joomla! Apprentice
- Posts: 7
- Joined: Wed Jul 16, 2008 3:59 pm
Re: How to set up an accessible template switcher?
OK
Ive started to do something similar myself but using a different template based on the domain name in use. Ive gone down a different route to do it but I can see that juanparati's code would work and can expand on what they said if it will help.
Tony
Ive started to do something similar myself but using a different template based on the domain name in use. Ive gone down a different route to do it but I can see that juanparati's code would work and can expand on what they said if it will help.
Tony
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
The code works!! Because I was used in two differente website.
Also you can change the template using the domain reference.
Example:
Use template1 from http://www.mysite1.com
and use template2 from http://www.mysite2.com
In the index.php of the default template you must add code like this (untested):
Also you can change the template using the domain reference.
Example:
Use template1 from http://www.mysite1.com
and use template2 from http://www.mysite2.com
In the index.php of the default template you must add code like this (untested):
Code: Select all
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
if ($_SERVER['HTTP_HOST']=='www.mysite2.com' || $_SERVER['HTTP_HOST']=='mysite2.com' )
$usesecond=true;
else
$usesecond=false;
if ($usesecond)
require(JPATH_SITE.DS.'templates'.DS.'second_template'.DS.'index.php');
else {
... Your template code
}
From the code to the reality!
- juanparati
- Joomla! Enthusiast
- Posts: 123
- Joined: Thu Nov 08, 2007 6:00 pm
- Location: Aarhus (Denmark)
Re: How to set up an accessible template switcher?
I am working in a plugin for doing this work!
From the code to the reality!
- JayShoe
- Joomla! Apprentice
- Posts: 28
- Joined: Fri May 04, 2007 5:02 pm
Re: How to set up an accessible template switcher?
Hello juanparati,
Thanks for this wonderful information. I have a software website that has online tutorials in a joomla blog. In my software, I want to be able to call up that section of the site with a specialized template that looks good inside the software. I only want the specialized template to show when inside the software, so I don't want to put a cookie on the user's computer because I'm assuming that when they go out of the software and load the site from their browser, if there is a cookie, the other template will show. Right now, I can call up the special template using www.example.com/?template=specialtemplate but when I click any link, it just goes right back to the other template.
Do you have any ideas? Do you have a plugin for this? One of the other ways I was thinking this could be solved is a way to append the ?template= variable to all links found on a particular page with a mambot. Can this be done?
Thanks for your help!
Jay
Thanks for this wonderful information. I have a software website that has online tutorials in a joomla blog. In my software, I want to be able to call up that section of the site with a specialized template that looks good inside the software. I only want the specialized template to show when inside the software, so I don't want to put a cookie on the user's computer because I'm assuming that when they go out of the software and load the site from their browser, if there is a cookie, the other template will show. Right now, I can call up the special template using www.example.com/?template=specialtemplate but when I click any link, it just goes right back to the other template.
Do you have any ideas? Do you have a plugin for this? One of the other ways I was thinking this could be solved is a way to append the ?template= variable to all links found on a particular page with a mambot. Can this be done?
Thanks for your help!
Jay
-
- Joomla! Apprentice
- Posts: 23
- Joined: Fri Apr 15, 2016 6:50 am
Re: How to set up an accessible template switcher?
Hello i have the exact problem. I try the solution that juanparati gave but i get blank page. Is there an other way? Or is there anyone that i can ask specific questions for this solution?
-
- Joomla! Apprentice
- Posts: 23
- Joined: Fri Apr 15, 2016 6:50 am
Re: How to set up an accessible template switcher?
can anyone please help us?