Pixelpost Forum

Pixelpost Forum (http://www.pixelpost.org/forum/index.php)
-   Hacks and Modifications (http://www.pixelpost.org/forum/forumdisplay.php?f=16)
-   -   Language Cookie (http://www.pixelpost.org/forum/showthread.php?t=9248)

RobbieMc 10-15-2008 08:46 PM

Language Cookie
 
Hi folks, it's been a long time since I was around.

I am back to tinkering with the language issues and have run into a problem. My wife's site, for which I originally developed the code for the multilingual pixelpost, has grown a bit. It now is a mix of Joomla and Pixelpost, and we are trying to make them work together.

We would like to set it up so that when a user selects a language on one part of the site, that language choice remains when switching to the other part of the site. The problem is that JoomFish (Joomla's multilingual extension) and Pixelpost use different cookie structures to store the language settings. I have tried hacking both sets of codes but for the life of me I can't get the two to work together.

Joomla sets the cookie name as 'jfcookie[lang]'
Pixelpost sets it as 'lang'

Any thoughts on how to make this work?

Thanks
Rob

jaywilliams 10-15-2008 09:07 PM

I don't know if this would work or not, but it's sure worth a try.

What if you added something like this to the bottom of your pixelpost.php file (located in the includes directory:
PHP Code:

if (isset($_COOKIE['jfcookie'])) {
    
// If the jfcookie is set, tell Pixelpost to use the same langauge:
    
$_GET['lang'] = $_COOKIE['jfcookie']['lang'];
}elseif(isset(
$_COOKIE['lang'])) {
    
// Otherwise, if the pixelpost langauge is set, set the cookie for jfcookie:
    
setcookie ('jfcookie[\'lang\']'substr($_COOKIE['lang'],0,2), time() +60*60*24*30'/'false0);


Note: this is un-tested, and might need a bit of tweaking, as I don't know exactly how your Joomla cookie system is setup.

RobbieMc 10-17-2008 05:40 PM

Thanks Jay. I will try it out this weekend.
Rob

RobbieMc 10-17-2008 05:44 PM

Based on a quick install, it doesn't work. The page comes back blank, so maybe there is a glitch somewhere in the syntax. I'll tinker with it this weekend.

Thanks again.
Rob

austriaka 10-17-2008 06:53 PM

I would just change the links from Joomla to Pixelpost and vice versa. Add a simple get variable to the URL: &lang=$_COOKIE['jfcookie']['lang'] of every PP link in Joomla and do that vice versa in the Links from Pixelpost to Joomla: &lang=$_COOKIE['lang']

Just check if the language abbreviations are the same in both systems, otherwise you need a check/replace for that


All times are GMT. The time now is 07:58 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.