How to set up an accessible template switcher?

General questions relating to Joomla! 1.5 There are other boards for more specific help on Joomla! features and extensions.

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.
Locked
Jim the Chin
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 230
Joined: Mon Apr 10, 2006 12:15 pm
Location: Cromer, Norfolk, UK

How to set up an accessible template switcher?

Post by Jim the Chin » Tue Mar 03, 2009 12:01 pm

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?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Thu Apr 30, 2009 2:09 pm

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:

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');
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.

:pop
From the code to the reality!

Jim the Chin
Joomla! Enthusiast
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?

Post by Jim the Chin » Thu Apr 30, 2009 5:56 pm

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

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Fri May 01, 2009 11:47 am

Remember replace [yourtemplate] for your template path.

Regards!
From the code to the reality!

Jim the Chin
Joomla! Enthusiast
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?

Post by Jim the Chin » Tue May 12, 2009 6:25 am

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?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Thu Jun 18, 2009 7:04 pm

From the code to the reality!

Jim the Chin
Joomla! Enthusiast
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?

Post by Jim the Chin » Fri Jun 19, 2009 4:03 am

That's this topic?
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Sun Jun 21, 2009 11:20 pm

Sorry!! A cut and paste error! :-[
From the code to the reality!

Jim the Chin
Joomla! Enthusiast
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?

Post by Jim the Chin » Mon Jun 22, 2009 5:41 am

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

companymerchant
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Jul 16, 2008 3:59 pm

Re: How to set up an accessible template switcher?

Post by companymerchant » Fri Aug 21, 2009 3:31 pm

Jim

Did you resolve this?

Tony

Jim the Chin
Joomla! Enthusiast
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?

Post by Jim the Chin » Fri Aug 21, 2009 6:08 pm

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.
Signature rules http://forum.joomla.org/viewtopic.php?f=8&t=65
Only exact urls allowed

companymerchant
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Jul 16, 2008 3:59 pm

Re: How to set up an accessible template switcher?

Post by companymerchant » Fri Aug 21, 2009 7:13 pm

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

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Sun Aug 23, 2009 9:37 am

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):

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!

User avatar
juanparati
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 123
Joined: Thu Nov 08, 2007 6:00 pm
Location: Aarhus (Denmark)

Re: How to set up an accessible template switcher?

Post by juanparati » Sun Aug 23, 2009 9:38 am

I am working in a plugin for doing this work!
From the code to the reality!

User avatar
JayShoe
Joomla! Apprentice
Joomla! Apprentice
Posts: 28
Joined: Fri May 04, 2007 5:02 pm

Re: How to set up an accessible template switcher?

Post by JayShoe » Mon Dec 14, 2009 5:32 pm

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

alex4842
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Apr 15, 2016 6:50 am

Re: How to set up an accessible template switcher?

Post by alex4842 » Fri Apr 22, 2016 1:25 pm

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?

alex4842
Joomla! Apprentice
Joomla! Apprentice
Posts: 23
Joined: Fri Apr 15, 2016 6:50 am

Re: How to set up an accessible template switcher?

Post by alex4842 » Thu May 05, 2016 11:28 am

can anyone please help us?


Locked

Return to “General Questions/New to Joomla! 1.5”