Page 4 of 4 FirstFirst ... 234
Results 31 to 38 of 38

Thread: language cookie

  1. #31
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Below is the code of my site.
    Can that be implemented ?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Welcome to the official website of Ceci Casariego Mazereel</TITLE>
    
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="imagetoolbar" content="no">
    
    <link href="stylesheet.css" rel="stylesheet" type="text/css">
    
    <style type="text/css">
    <!--
    
    .id {
    
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 8px;
    	color: #000000;
    }
    -->
    </style>
    
    </head>
    
    <style>
    a:hover{text-decoration:none}
    </style>
    
    <style type="text/css">
    <!--
    
    body
    	{
    	scrollbar-face-color:white;
    	scrollbar-arrow-color:white;
    	scrollbar-track-color:white;
    	scrollbar-shadow-color:white;
    	scrollbar-highlight-color:white;
    	scrollbar-3dlight-color:white;
    	scrollbar-darkshadow-Color:white;	
    	background-attachment: fixed;
    }
    
    -->
    </style>
    
    <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    
    <script language=JavaScript>
    <!--
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    </script>
    
    <table width="100&#37;" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td align="center" valign="middle"> 
          
    <table width="500" border="0" cellpadding="0" cellspacing="0">
    <tr><td height="410">
    	
    <table width="500" height="410" border="0" cellpadding="0" cellspacing="0" bgcolor=white>
    <tr><td>
                    
    <div style="width:490px;height:400px;overflow:auto;">
    
    <table width=90% height=100% align=center valign=middle>
    <tr><td align=center valign=middle style="padding-top:10px; padding-bottom:10px;">
    <img src="indexlogo.jpg" border="0">
    <br>
    <br>
    <ilayer width=98% height=20 name="dep1">
    				<layer name="dep2" width=98% height=20>
    				</layer>
    				</ilayer>
    				<div id="describe" style="bgcolor:'white';width:200px;height:32px" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>
    				<script language="JavaScript1.2">
    				var submenu=new Array()
    				submenu[0]='<font color="5A6673">Welcome to the official site of<br>Ceci Casariego-Mazereel</font>'
    				submenu[1]='<font color="5A6673">Bienvenu au site officiel de<br>Ceci Casariego-Mazereel</font>'
    				submenu[2]='<font color="5A6673">Welkom op de offici&#235le site van<br>Ceci Casariego-Mazereel</font>'
    				var delay_hide=10
    				var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
    				function showit(which){
    				clear_delayhide()
    				thecontent=(which==-1)? "" : submenu[which]
    				if (document.getElementById||document.all)
    				menuobj.innerHTML=thecontent
    				else if (document.layers){
    				menuobj.document.write(thecontent)
    				menuobj.document.close()
    				}
    				}
    				function resetit(e){
    				if (document.all&&!menuobj.contains(e.toElement))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				}
    				function clear_delayhide(){
    				if (window.delayhide)
    				clearTimeout(delayhide)
    				}
    				function contains_ns6(a, b) {
    				while (b.parentNode)
    				if ((b = b.parentNode) == a)
    				return true;
    				return false;
    				}
    				</script>
    				<a href="EN/indexEN.html" onMouseover="showit(0)"><img src="NL/img/icon/vlagEN.gif" style="border:0"></a>
    				<a href="FR/indexFR.html" onMouseover="showit(1)"><img src="NL/img/icon/vlagFR.gif" style="border:0"></a>
    				<a href="NL/indexNL.html" onMouseover="showit(2)"><img src="EN/img/icon/vlagNL.gif" style="border:0"></a>				
    <p>
    <font class="id">
    all content and visuals copyright 2004-2007<br>
    best viewed with IE 5+ in 1280*1024 </font>
    
    </td></tr></table>
    
    </div>
    
    			</td>
                        </tr>
                        
                      </table></td>
                  </tr>
                </table></td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    </body>
    </html>

  2. #32
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Code:
    <?php
    
    $homepage = 'http://'.$_SERVER["HTTP_HOST"].'/';
    
    if ($_REQUEST['act'] == "setLang") { 
    
    //check to see if the form has been submitted!
    
        if ($_REQUEST['lang'] == "") {
              header('Location: '.$_SERVER["PHP_SELF"]); 
    
    //if language selection is empty, redirect to form!
        }
    
        else {
    //if language was selected, save it in a cookie, then redirect to appropriate page!
            $lang = $_REQUEST['lang'];
            setcookie("language, $lang, time()+3600);
            header('Location: '.$homepage.$lang.'/index'.$lang.'.html');
        }
    }
    
    else {
    
    //if form has not been submitted
    
       if (@$_COOKIE['language'] != "") {
    /* check to see if language cookie is empty. If not, redirect to appropriate page. */
    
       header('Location: '.$homepage.$_COOKIE["language"].'/index'.$_COOKIE["language"].'.html');
       }
    
       else {
    
    //if cookie is empty, display form
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Welcome to the official website of Ceci Casariego Mazereel</TITLE>
    
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="imagetoolbar" content="no">
    
    <link href="stylesheet.css" rel="stylesheet" type="text/css">
    
    <style type="text/css">
    <!--
    
    .id {
    
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 8px;
    	color: #000000;
    }
    -->
    </style>
    
    </head>
    
    <style>
    a:hover{text-decoration:none}
    </style>
    
    <style type="text/css">
    <!--
    
    body
    	{
    	scrollbar-face-color:white;
    	scrollbar-arrow-color:white;
    	scrollbar-track-color:white;
    	scrollbar-shadow-color:white;
    	scrollbar-highlight-color:white;
    	scrollbar-3dlight-color:white;
    	scrollbar-darkshadow-Color:white;	
    	background-attachment: fixed;
    }
    
    -->
    </style>
    
    <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    
    <script language=JavaScript>
    <!--
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    </script>
    
    <table width="100&#37;" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td align="center" valign="middle"> 
          
    <table width="500" border="0" cellpadding="0" cellspacing="0">
    <tr><td height="410">
    	
    <table width="500" height="410" border="0" cellpadding="0" cellspacing="0" bgcolor=white>
    <tr><td>
                    
    <div style="width:490px;height:400px;overflow:auto;">
    
    <table width=90% height=100% align=center valign=middle>
    <tr><td align=center valign=middle style="padding-top:10px; padding-bottom:10px;">
    <img src="indexlogo.jpg" border="0">
    <br>
    <br>
    <ilayer width=98% height=20 name="dep1">
    				<layer name="dep2" width=98% height=20>
    				</layer>
    				</ilayer>
    				<div id="describe" style="bgcolor:'white';width:200px;height:32px" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>
    				<script language="JavaScript1.2">
    				var submenu=new Array()
    				submenu[0]='<font color="5A6673">Welcome to the official site of<br>Ceci Casariego-Mazereel</font>'
    				submenu[1]='<font color="5A6673">Bienvenu au site officiel de<br>Ceci Casariego-Mazereel</font>'
    				submenu[2]='<font color="5A6673">Welkom op de offici&#235le site van<br>Ceci Casariego-Mazereel</font>'
    				var delay_hide=10
    				var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
    				function showit(which){
    				clear_delayhide()
    				thecontent=(which==-1)? "" : submenu[which]
    				if (document.getElementById||document.all)
    				menuobj.innerHTML=thecontent
    				else if (document.layers){
    				menuobj.document.write(thecontent)
    				menuobj.document.close()
    				}
    				}
    				function resetit(e){
    				if (document.all&&!menuobj.contains(e.toElement))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				}
    				function clear_delayhide(){
    				if (window.delayhide)
    				clearTimeout(delayhide)
    				}
    				function contains_ns6(a, b) {
    				while (b.parentNode)
    				if ((b = b.parentNode) == a)
    				return true;
    				return false;
    				}
    				</script>
    				<a href="?act=setLang&lang=EN" onMouseover="showit(0)"><img src="NL/img/icon/vlagEN.gif" style="border:0"></a>
    				<a href="?act=setLang&lang=FR" onMouseover="showit(1)"><img src="NL/img/icon/vlagFR.gif" style="border:0"></a>
    				<a href="?act=setLang&lang=NL" onMouseover="showit(2)"><img src="EN/img/icon/vlagNL.gif" style="border:0"></a>				
    <p>
    <font class="id">
    all content and visuals copyright 2004-2007<br>
    best viewed with IE 5+ in 1280*1024 </font>
    
    </td></tr></table>
    
    </div>
    
    			</td>
                        </tr>
                        
                      </table></td>
                  </tr>
                </table></td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    </body>
    </html>
    
    <?php
       }
    
    }
    ?>
    Try that, it should work, but let me know if it doesn't.
    Last edited by thetestingsite; 02-21-2007 at 03:54 PM.

  3. #33
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

  4. #34
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Ok, found the problem and it is fixed now. Below is the code and you will see the one little thing that was causing it to show a blank page highlighted in red.

    Code:
    <?php
    
    $homepage = 'http://'.$_SERVER["HTTP_HOST"].'/';
    
    if ($_REQUEST['act'] == "setLang") { 
    
    //check to see if the form has been submitted!
    
        if ($_REQUEST['lang'] == "") {
              header('Location: '.$_SERVER["PHP_SELF"]); 
    
    //if language selection is empty, redirect to form!
        }
    
        else {
    //if language was selected, save it in a cookie, then redirect to appropriate page!
            $lang = $_REQUEST['lang'];
            setcookie("language", $lang, time()+3600);
            header('Location: '.$homepage.$lang.'/index'.$lang.'.html');
        }
    }
    
    else {
    
    //if form has not been submitted
    
       if (@$_COOKIE['language'] != "") {
    /* check to see if language cookie is empty. If not, redirect to appropriate page. */
    
       header('Location: '.$homepage.$_COOKIE["language"].'/index'.$_COOKIE["language"].'.html');
       }
    
       else {
    
    //if cookie is empty, display form
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>Welcome to the official website of Ceci Casariego Mazereel</TITLE>
    
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta http-equiv="imagetoolbar" content="no">
    
    <link href="stylesheet.css" rel="stylesheet" type="text/css">
    
    <style type="text/css">
    <!--
    
    .id {
    
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 8px;
    	color: #000000;
    }
    -->
    </style>
    
    </head>
    
    <style>
    a:hover{text-decoration:none}
    </style>
    
    <style type="text/css">
    <!--
    
    body
    	{
    	scrollbar-face-color:white;
    	scrollbar-arrow-color:white;
    	scrollbar-track-color:white;
    	scrollbar-shadow-color:white;
    	scrollbar-highlight-color:white;
    	scrollbar-3dlight-color:white;
    	scrollbar-darkshadow-Color:white;	
    	background-attachment: fixed;
    }
    
    -->
    </style>
    
    <body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    
    <script language=JavaScript>
    <!--
    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if 
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers) 
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
    
    document.oncontextmenu=new Function("return false")
    // --> 
    </script>
    
    <table width="100&#37;" height="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td align="center" valign="middle"> 
          
    <table width="500" border="0" cellpadding="0" cellspacing="0">
    <tr><td height="410">
    	
    <table width="500" height="410" border="0" cellpadding="0" cellspacing="0" bgcolor=white>
    <tr><td>
                    
    <div style="width:490px;height:400px;overflow:auto;">
    
    <table width=90% height=100% align=center valign=middle>
    <tr><td align=center valign=middle style="padding-top:10px; padding-bottom:10px;">
    <img src="indexlogo.jpg" border="0">
    <br>
    <br>
    <ilayer width=98% height=20 name="dep1">
    				<layer name="dep2" width=98% height=20>
    				</layer>
    				</ilayer>
    				<div id="describe" style="bgcolor:'white';width:200px;height:32px" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>
    				<script language="JavaScript1.2">
    				var submenu=new Array()
    				submenu[0]='<font color="5A6673">Welcome to the official site of<br>Ceci Casariego-Mazereel</font>'
    				submenu[1]='<font color="5A6673">Bienvenu au site officiel de<br>Ceci Casariego-Mazereel</font>'
    				submenu[2]='<font color="5A6673">Welkom op de offici&#235le site van<br>Ceci Casariego-Mazereel</font>'
    				var delay_hide=10
    				var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""
    				function showit(which){
    				clear_delayhide()
    				thecontent=(which==-1)? "" : submenu[which]
    				if (document.getElementById||document.all)
    				menuobj.innerHTML=thecontent
    				else if (document.layers){
    				menuobj.document.write(thecontent)
    				menuobj.document.close()
    				}
    				}
    				function resetit(e){
    				if (document.all&&!menuobj.contains(e.toElement))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    				delayhide=setTimeout("showit(-1)",delay_hide)
    				}
    				function clear_delayhide(){
    				if (window.delayhide)
    				clearTimeout(delayhide)
    				}
    				function contains_ns6(a, b) {
    				while (b.parentNode)
    				if ((b = b.parentNode) == a)
    				return true;
    				return false;
    				}
    				</script>
    				<a href="?act=setLang&lang=EN" onMouseover="showit(0)"><img src="NL/img/icon/vlagEN.gif" style="border:0"></a>
    				<a href="?act=setLang&lang=FR" onMouseover="showit(1)"><img src="NL/img/icon/vlagFR.gif" style="border:0"></a>
    				<a href="?act=setLang&lang=NL" onMouseover="showit(2)"><img src="EN/img/icon/vlagNL.gif" style="border:0"></a>				
    <p>
    <font class="id">
    all content and visuals copyright 2004-2007<br>
    best viewed with IE 5+ in 1280*1024 </font>
    
    </td></tr></table>
    
    </div>
    
    			</td>
                        </tr>
                        
                      </table></td>
                  </tr>
                </table></td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    </body>
    </html>
    
    <?php
       }
    
    }
    ?>
    That one quotation mark caused the whole script to error. Anyways, I tested it (to the extent that I could) and it works. The cookie gets set with the selection, then it redirects to the correct page. Also, when you revisit the page, it redirects you to the language you have chosen previously.

    Hope this helps and let me know if you need any more help.

  5. #35
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    Don't know why, but I still get a blank page.
    When I copy the above code, it all shows up in one line.
    Could that cause the error ?

  6. #36
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

    Default

    I have issues with this script.
    This is the code I have now:
    Code:
    <?php
    
    $homepage = 'http://'.$_SERVER["HTTP_HOST"].'/';
    
    if ($_REQUEST['act'] == "setLang") { 
    
    //check to see if the form has been submitted!
    
    if ($_REQUEST['lang'] == "") {
    header('Location: '.$_SERVER["PHP_SELF"]); 
    
    //if language selection is empty, redirect to form!
    }
    
    else {
    //if language was selected, save it in a cookie, then redirect to appropriate page!
    $lang = $_REQUEST['lang'];
    setcookie("language", $lang, time()+3600);
    header('Location: '.$homepage.$lang.'/index'.$lang.'.php');
    }
    }
    
    else {
    
    //if form has not been submitted
    
    if (@$_COOKIE['language'] != "") {
    /* check to see if language cookie is empty. If not, redirect to appropriate page. */
    
    header('Location: '.$homepage.$_COOKIE["language"].'/index'.$_COOKIE["language"].'.php');
    }
    
    else {
    
    //if cookie is empty, display form
    ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
                "http://www.w3.org/TR/html4/strict.dtd">
    
    <head>
    
    <title>Ceci Casariego: portretten, portret, interieur decoratie, ontwerp en creaties</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link rel="stylesheet" media="all" type="text/css" href="site.css">
    <meta http-equiv="imagetoolbar" content="no">
    <script src="links.js" type="text/javascript"></script>
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
    
    </head>
    <body>
    <div id="header-main">
    <div id="header">
    
    <h1>Ceci CASARIEGO</h1>
    <ul>
    <li class="nav"><a href="?act=setLang&lang=NL">Nederlands</a></li>
    <li class="nav"><a href="?act=setLang&lang=EN">English</a></li>
    <li class="nav"><a href="?act=setLang&lang=FR">Fran&#231ais</a></li>
    </ul>
    </div>
    
    </div>
    
    <div id="body-main">
    <div id="body">
    <div id="left">
    </div>
    
    <div id="right">
    </div>
    
    </div>
    </div>
    
    </body>
    </html>
    
    <?php
    }
    
    }
    ?>
    I highlighted the added php. The href I need the links to go to are indexNL.php, indexGB.php and indexFR.php , but they don't direct to these pages. What needs to be changed, please ?

  7. #37
    Join Date
    Jul 2006
    Location
    Antwerp, Belgium (Europe)
    Posts
    927
    Thanks
    121
    Thanked 2 Times in 2 Posts

  8. #38
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It indeed looks strange that the href where your site should be going to, does not include the names of the pages. But I am no expert !

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •