I will be storing identical copies of index.php in www.site.com/english and www.site.com/czech. Is there anyway for index.php to determine which folder (language) it is in? I would like either “english” or “czech” returned.
echo getcwd();
Using a cookie. Using a conditional statement or better using a member setting with a database connection which is in the member cp, so if user checks the box, it adds CZECH record in the database to 1 and then when logged in return 1?? Or conditional… new to php myself but…
while ($row = $result->fetch_assoc())
{
printf("index.php?lang="'.$row['Lang']).'");
} else {
include "langpicker_dropdown_html_snippet_or_check_box.inc";
// return the list
return $myLang;
}
Anyone can correct me
The best way to do it would be to use patinfo()
$path = $_SERVER['PHP_SELF']; //something like /var/www/sitename/czech/index.php
$split_path = pathinfo($path); //Creates associative array of parts
$language = substr(strrchr($split_path['dirname'],'/'),1); //should give you 'czech'