Question 1:
My website is completely divided into two languages - English and Polish. When someone opens the gallery from a polish page, I would like the language used to be polish, and when opened from an english page - english. All my English pages are prefixed with en_ and all the Polish ones with pl_. How can I use the fact that there will be two separate links for two separate languages to automatically open ZenPhoto with the correct language from that link without having to use the form printLanguageSelector gives?
Question 2:
I use printPageListWithNav, but I would like for this whole nav bar to not appear if I only have 1 page. I assume the method will look something like this:
<?php if ($numPages != 1) { printLanguageSelector(); } ?>
But I have no idea what $numPages really should be. Can anyone help me with this, and tell me how to find this for myself in the future? I tried looking for something that might work here but I couldn't find anything I'd know how to use to solve this:
http://www.zenphoto.org/documentation/functions/_template-functions.php.html
Comments
If this is not the case you will have to set a cookie for the users declaring the language they should use. I think you can cause this to happen by using a SUBMIT method to link to the zenphoto index.php passing a parameter of `dynamic-locale` set to the correct locale tuple. I have not tried this, though. If it does not work you will have to come up with some other way to set the cookie.
#2. The function you want is `getTotalPages()`. The way you find something like this is to search the docs page for phrases which might be in the function name. In this case `pages` quickly yielded the answer. ('page` came up with many 'false" matches so it was not as useful, but did lead to the function eventually.) Unfortunately, it is a matter of making educated guesses until you become more familiar with the functins.
1- I have to try this, as everything in my PC is set to English, I'll ask someone with Polish settings to try my gallery now. On the other hand, I would love to be able to have some variable or cookie set when people click on one of the two buttons when you enter my site: english | polish
So if they click on Polish, php does something that will let zenphoto know it should load the polish locale when they eventually get to the gallery. You said I should set a cookie using SUBMIT. If I wanted to use SUBMIT I would need to change those english | polish links into form buttons, I'd rather not do this. I will read some php tutorials on setting a cookie without using forms, could you link me to a page that will tell me what content must appear in this cookie?
2- Thank you again!
Ex link:
http://domain.com/index.php?lang=en
http://domain.com/index.php?lang=pl
So your could put a button on your form with the following:
`
`
for the English one. I'll leave the Polish version to you--I am not fluent
Cookies seem really tricky. I have not found how to set a cookie for zenphoto from outside of the zenphoto folders.
He said "How can I use the fact that there will be two separate links for two separate languages to automatically open ZenPhoto with the correct language from that link without having to use the form printLanguageSelector gives?"
Cant he do something like
index.php?dynamic_locale=en_US
`.submit()">`
www.panopixel.org
Currently the gallery button links to a fubar page, but it normally would link to http://www.panopixel.org/zenphoto/
Now that ZenPhoto supports more than 1 language, could I change that link to:
for example?
code wrote "index.php?dynamic_locale=en_US" and you wrote "yes", so I can use that? That is an option that would suite me, if it works.
Why can't you just use our language selector. Of course I know that this standard dropdown may not fit in style, but you could use my snippet from above to make two links for switching instead of the dropdown. Also you then could skip this entry page (which is not SEO friendly by the way).
Please take a look at my site www.panopixel.org
The user has to select a language only once the first time he enters my site and never again. Since they enter for example into the English section, everything is in English. All links in the menu are in english, and one of those links points to zenphoto. I cannot replace one of the menu links with a form button because although I know its possible to replace a form button with an image, I think it it's not cross-browser safe and I dont know if it will work without javascript, and having a language selector in the gallery isn't consistent with the rest of the site anyway.
Is seems pretty important to me that zenphoto should allow languages to be selected using a variable in a url, e.g. http://domain.com/index.php?lang=en
If need be, that selection can then be saved by some zenphoto script in the index.php file so that all other zenphoto pages respect it.
So two questions now:
1- is it possible to make zenphoto respect the language that the user chose for the rest of my site without using a form (ie. using something that I can put in that menu of mine), and
2- if the answer to 1 is 'no', then what if I change the two links on the main www.panopixel.org page into form buttons, knowing that the user will have to choose english or polish on that page to go further, then get taken to the main page in the chosen langage, and only then can he launch zenphoto, will the $post from the main page still 'hold' several pages away? I hope I wrote this clearly... there is at least 1 intermediate page between the language selection and zenphoto, often more than 1, so will a $post click on page 1 still exist when someone changes page 1 to page 2, 3, 4 and then page 5 which is zenphoto?
The above suggestions seem like reasonable solutions. There if you use acrylian's suggestion your site will look no different than it does now so I don't know what your problem is.