Englishhaha wops... Well I will give myself a big pat on the shoulder for that!
Thanks alot for helping me, will try to install the languageSwitch the correct way this time :)
I've fixed the problem : instead of modifying [Administration > Plugins > LocalFiles Editor > Personal Plugin] , you had modified [Administration > Plugins > LocalFiles Editor > Local config].
Yes I did all the 3 steps including deleting Personal Plugin in the database.
All code that I got from you is taken out and still it doesnt work.... It's very very strange.
Wallster wrote:
Tried it all, it still does'nt work. It's very strange.
So you confirm you tried:
1) renaming the "PersonalPlugin" directory
2) deactivating the PersonalPlugin directly in the database
3) restore the previous version of your header.tpl file
If you answer yes to all these questions, yes it's very strange :-/
Wallster wrote:
Can I try to delete PersonalPlugin in my database without anything major crashes?
Yes you can try also.
Tried it all, it still does'nt work. It's very strange. Can I try to delete PersonalPlugin in my database without anything major crashes?
In case it doesn't solve your problem, can try to use the previous version of the header.tpl file?
Wallster wrote:
Is there any way I can uninstall this plugin without being able to access the admin panel?
Yes, if you can perform a MySQL query (with PhpMyAdmin) :
update piwigo_plugins set state = 'inactive' where id = 'PersonalPlugin';
Tried to rename the folder from Personal Plugin to Personal Pluginold, did'nt make any difference.
At the moment im running the webserver from One.com, it's a very cheap webserver, doubt that I can get an apache error log file.
Is there any way I can uninstall this plugin without being able to access the admin panel?
This Personal Plugin works on my Piwigo installation. I suppose there is a conflict with another plugin or that my PHP code is not compatible with your PHP version.
Do you have an Apache error log file?
Wallster wrote:
As soon as I tried to save "personal plugin" my gallery stopped working. Now I can't access it, can you?
http://wallstudio.se/myiceland/gallery
by your FTin plugin directory
rename PersonalPlugin to PersonalPluginold
As soon as I tried to save "personal plugin" my gallery stopped working. Now I can't access it, can you?
http://wallstudio.se/myiceland/gallery
OK, let's start with a solution to add 3 languages in your header, as shown in my previous screenshot.
You told me you had directly modified header.tpl. Please make sure you don't modify themes/simple/template/header.tpl : duplicate it as themes/myiceland/template/header.tpl (so that you won't loose your specific changes when you update the Simple theme).
Now in themes/myiceland/template/header.tpl just after <div id="mi-logo-gallery">...</div> insert :
<div id="mi-languageSwitch">
<ul>
{foreach from=$languages item=language}
<li class="{if $language.is_current}currentLanguage{/if}"><a href="{$language.url}">{$language.name} <img src="{$ROOT_URL}language/{$language.code}/{$language.code}.jpg"></a></li>
{/foreach}
</ul>
</div>Create a Personal Plugin :
1) activate the LocalFiles Editor plugin
2) go to [Administration > Plugins > LocalFiles Editor > Personal Plugin] and paste the following code:
<?php
/*
Plugin Name: Personal Plugin
Version: 1.0
Description: Personal Plugin
Plugin URI: http://piwigo.org
Author:
Author URI:
*/
add_event_handler('loading_lang', 'myiceland_language_switch');
// add_event_handler('init', 'myiceland_language_switch');
function myiceland_language_switch()
{
global $user;
$same = $user['language'];
if (isset($_GET['lang']))
{
if (!empty($_GET['lang']) and file_exists(PHPWG_ROOT_PATH.'language/'.$_GET['lang'].'/common.lang.php'))
{
if (is_a_guest() or is_generic())
{
pwg_set_session_var( 'lang_switch', $_GET['lang'] );
}
else
{
$query = '
UPDATE '.USER_INFOS_TABLE.'
SET language = \''.$_GET['lang'].'\'
WHERE user_id = '.$user['id'].'
;';
pwg_query($query);
}
$user['language'] = $_GET['lang'];
}
}
elseif (is_a_guest() or is_generic())
{
$user['language'] = pwg_get_session_var('lang_switch', $user['language']);
}
// Reload language only if it isn't the same one
if ($same !== $user['language'])
{
load_language('common.lang', '', array('language'=>$user['language']));
load_language(
'lang',
PHPWG_ROOT_PATH.'local/',
array(
'language' => $user['language'],
'no_fallback' => true,
'local' => true,
)
);
if (defined('IN_ADMIN') and IN_ADMIN) { // Never currently
load_language('admin.lang', '', array('language'=>$user['language']) );
}
}
}
add_event_handler('loc_begin_page_header', 'myiceland_languages_in_header');
function myiceland_languages_in_header()
{
global $template, $user;
$language_code_to_name = get_languages();
$base_url = duplicate_index_url();
if (script_basename() == 'picture')
{
$base_url = duplicate_picture_url();
}
$base_url = add_url_params(
$base_url,
array('lang' => '')
);
$languages = array();
$language_codes = array('sv_SE', 'en_UK', 'de_DE');
foreach ($language_codes as $language_code)
{
$language = array(
'name' => preg_replace('/\s\[.*\]$/', '', $language_code_to_name[$language_code]),
'code' => $language_code,
'url' => $base_url.$language_code,
'is_current' => ($language_code == $user['language']),
);
array_push($languages, $language);
}
$template->assign('languages', $languages);
}
?>3) go to [Administration > Plugins > Manage], install and activate the "Personal Plugin"
If you want to change the list of languages in your header, in your Personal Plugin, function myiceland_languages_in_header() change the line:
$language_codes = array('sv_SE', 'en_UK', 'de_DE');Last step is to set the correct CSS rules in themes/myiceland/theme.css for example in the screenshot I used:
#mi-languageSwitch {
position: absolute;
left: 875px;
top: 5px;
width: 60px;
text-align: right;
line-height: 20px;
}
#mi-languageSwitch ul {
margin:0;
padding:0
}
#mi-languageSwitch li.currentLanguage a {
color:#279AB2;
}
#mi-languageSwitch li img {
margin-bottom: -3px;
}Wallster wrote:
ddtddt: Yes the plan is to have it in Icelandic, would you be interested in having an Icelandic translation of Piwigo as well?
oh yes :-) :-) :-)
I like it, will start off with 3 languages!
For your information, here is what I pasted in the HTML code, just after #mi-logo-gallery. This is not a good code, it's just for prototyping.
<div style="position: absolute; left: 875px; top: 5px; width: 60px; text-align: right; line-height: 20px;" id="mi-languageSwitch">
<ul style="margin:0;padding:0">
<li>Svenska <img style="margin-bottom: -3px;" src="http://wallstudio.se/myiceland/gallery/language/sv_SE/sv_SE.jpg"></li>
<li style="color:#279AB2">English <img style="margin-bottom: -3px;" src="http://wallstudio.se/myiceland/gallery/language/en_UK/en_UK.jpg"></li>
<li>Deutsch <img style="margin-bottom: -3px;" src="http://wallstudio.se/myiceland/gallery/language/de_DE/de_DE.jpg"></li>
</ul>
</div>