Note that there are some explanatory texts on larger screens.

plurals
  1. POWarning: Cannot modify header information (something wrong with a localization PHP file)
    primarykey
    data
    text
    <p>My web server shows me the following warning, and I think know where is the problem:</p> <blockquote> <p>WARNING: CANNOT MODIFY HEADER INFORMATION - HEADERS ALREADY SENT BY (OUTPUT STARTED AT /WWW/ZXQ.NET/A/L/E/ALEXCHEN/HTDOCS/TEST/INDEX.PHP:10) IN /WWW/ZXQ.NET/A/L/E/ALEXCHEN/HTDOCS/TEST/LOCALIZATION.PHP ON LINE 14</p> </blockquote> <p>But I don't know exactly how to solve it.</p> <p>Any suggestions?</p> <p><strong>localization:</strong></p> <pre><code>&lt;?php //set session and cookies session_start(); header('Cache-control: private'); // IE 6 FIX function get_lang(){ if(!empty($_GET['lang'])) return $_GET['lang']; if(!empty($_SESSION['lang'])) return $_SESSION['lang']; if(!empty($_COOKIE['lang'])) return $_COOKIE['lang']; return 'en'; } function set_lang($lang){ setcookie("lang", $lang, time() + (3600 * 24 * 30)); //line 14 $_SESSION['lang'] = $lang; } function get_lang_file($lang){ $lang_file = "languages/lang.$lang.php"; if(file_exists($lang_file)) return $lang_file; if($lang_file = get_lang_file('en')) return $lang_file; return false; } //set translation helper function function l($string){ static $localization; if(!isset($localization)){ $lang = get_lang(); $lang_file = get_lang_file($lang); if($lang_file) set_lang($lang); $localization = include $lang_file; } return $localization[$string]; } ?&gt; </code></pre> <p><strong>index.php:</strong></p> <pre><code>&lt;?php include_once 'localization.php'; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="robots" content="index, follow"/&gt; &lt;meta name="description" content="Web design and Translation / 網頁設計和翻譯" /&gt; &lt;meta name="keywords" content="web development, web developer, web design, web designer, translation, translator, taiwan, taipei, taichung, english, chinese, spanish, 網站開發者, 網頁設計, 網頁設計師, 翻譯, 翻譯著, 台灣, 台北, 台中, 英文, 中文, 西班牙文, html, css, javascript, php" /&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/&gt; &lt;title&gt;Alex Chen - Web design and Translation / 網頁設計和翻譯&lt;/title&gt; &lt;link rel="stylesheet" type="text/css" href="styles/reset.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="styles/global.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" /&gt; &lt;?php if(get_lang() == 'zh-tw' || get_lang() == 'zh-cn') {echo '&lt;link rel="stylesheet" type="text/css" href="styles/chinese.css" /&gt;';} ?&gt; &lt;/head&gt; &lt;body id="home"&gt; &lt;div id="header"&gt; &lt;div class="container"&gt; &lt;ul id="lang"&gt; &lt;li &lt;?php if(get_lang() == 'en') {echo 'class="current"';} ?&gt;&gt;&lt;a href="index.php?lang=en"&gt;ENGLISH&lt;/a&gt;&lt;/li&gt; &lt;li &lt;?php if(get_lang() == 'es') {echo 'class="current"';} ?&gt;&gt;&lt;a href="index.php?lang=es"&gt;ESPAÑOL&lt;/a&gt;&lt;/li&gt; &lt;li &lt;?php if(get_lang() == 'zh-tw') {echo 'class="current"';} ?&gt;&gt;&lt;a href="index.php?lang=zh-tw"&gt;中文(繁體)&lt;/a&gt;&lt;/li&gt; &lt;li &lt;?php if(get_lang() == 'zh-cn') {echo 'class="current"';} ?&gt;&gt;&lt;a href="index.php?lang=zh-cn"&gt;中文(简体)&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="logo-bg"&gt; &lt;h1&gt;&lt;a&gt;ALEXCHEN&lt;/a&gt;&lt;/h1&gt; &lt;/div&gt; &lt;div id="nav-bg"&gt; &lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="#content"&gt;&lt;?php echo l('nav1'); ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#contact"&gt;&lt;?php echo l('nav2'); ?&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- .container --&gt; &lt;/div&gt;&lt;!-- #header --&gt; &lt;div id="content"&gt; &lt;div class="container"&gt; &lt;div class="showcase"&gt; &lt;div class="first"&gt; &lt;div id="nopic"&gt; &lt;p&gt;&lt;?php echo l('tagline_p'); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- .first --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase1_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase1_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase1" href="showcase/showcase1.php"&gt;&lt;img src="images/showcase1t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase2_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase2_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase2" href="showcase/showcase2.php"&gt;&lt;img src="images/showcase2t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase4_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase4_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase4" href="showcase/showcase4.php"&gt;&lt;img src="images/showcase4t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase9_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase9_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase9" href="showcase/showcase9.php"&gt;&lt;img src="images/showcase9t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pushed --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase5_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase5_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase5" href="showcase/showcase5.php"&gt;&lt;img src="images/showcase5t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase8_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase8_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase8" href="showcase/showcase8.php"&gt;&lt;img src="images/showcase8t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pushed --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase6_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase6_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase6" href="showcase/showcase6.php"&gt;&lt;img src="images/showcase6t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase7_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase7_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase7" href="showcase/showcase7.php"&gt;&lt;img src="images/showcase7t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pushed --&gt; &lt;/div&gt;&lt;!-- .showcase --&gt; &lt;div class="pusher"&gt; &lt;h3&gt;&lt;?php echo l('showcase3_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('showcase3_p'); ?&gt;&lt;/p&gt; &lt;div class="pic"&gt; &lt;a id="showcase3" href="showcase/showcase3.php"&gt;&lt;img src="images/showcase3t.png"/&gt;&lt;/a&gt; &lt;/div&gt;&lt;!-- .pic --&gt; &lt;/div&gt;&lt;!-- .pusher --&gt; &lt;/div&gt;&lt;!-- .container --&gt; &lt;/div&gt;&lt;!-- #work --&gt; &lt;div id="footer"&gt; &lt;div class="container"&gt; &lt;div id="footer-top"&gt; &lt;div id="about"&gt; &lt;h3&gt;&lt;?php echo l('about_h3'); ?&gt;&lt;/h3&gt; &lt;img src="images/profile.png"/&gt; &lt;p&gt;&lt;?php echo l('about_p'); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;div id="info"&gt; &lt;h3&gt;&lt;?php echo l('info_h3'); ?&gt;&lt;/h3&gt; &lt;ul&gt; &lt;li id="mobile"&gt;&lt;p&gt;&lt;/p&gt;0918051170&lt;/li&gt; &lt;li id="gmail"&gt;&lt;p&gt;&lt;/p&gt;&lt;a href="mailto:janoochen@gmail.com"&gt;alexchen.net@gmail.com&lt;/a&gt;&lt;/li&gt; &lt;li id="skype"&gt;&lt;p&gt;&lt;/p&gt;alexchen.net&lt;/li&gt; &lt;li id="facebook"&gt;&lt;a href="http://www.facebook.com/weedd.chen"&gt;facebook&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="contact"&gt; &lt;h3&gt;&lt;?php echo l('contact_h3'); ?&gt;&lt;/h3&gt; &lt;p&gt;&lt;?php echo l('contact_p'); ?&gt;&lt;/p&gt; &lt;form id="sendmail" method="post" action="http://www.emailmeform.com/fid.php?formid=254816"&gt; &lt;label for="name"&gt;&lt;?php echo l('form_label1'); ?&gt;&lt;/label&gt; &lt;input type="text" id="name" name="FieldData0" /&gt; &lt;label for="email"&gt;&lt;?php echo l('form_label2'); ?&gt;&lt;/label&gt; &lt;input type="text" id="email" name="FieldData1" /&gt; &lt;label for="message"&gt;&lt;?php echo l('form_label3'); ?&gt;&lt;/label&gt; &lt;textarea type="text" id="message" name="FieldData2"&gt;&lt;/textarea&gt; &lt;input id="button" type="submit" value="&lt;?php echo l('submit'); ?&gt;"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- #footer-top --&gt; &lt;div id="footer-bottom"&gt; &lt;div id="rights"&gt; &lt;p&gt;Copyright © 2010 Alex Chen. All Rights Reserved. Hosted on &lt;a href="http://www.zymic.com"&gt;Zymic&lt;/a&gt;. Contact form hosted on &lt;a href="http://www.emailmeform.com"&gt;Email Me Form&lt;/a&gt;.&lt;/p&gt; &lt;/div&gt; &lt;div id="ads"&gt; &lt;a id="nr" href="http://www.freedomain.co.nr/cheap_web_hosting.php" target="_blank"&gt;&lt;img src="http://ruarmza.4u.com.ru/ch.gif" alt="Cheap Web Hosting Providers" width="88" height="31" border="0" /&gt;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- #footer-bottom --&gt; &lt;/div&gt;&lt;!-- .container --&gt; &lt;/div&gt;&lt;!-- #footer --&gt; &lt;script type="text/javascript"&gt; var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-13164175-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); &lt;/script&gt;&lt;!-- google analytics --&gt; &lt;script type="text/javascript" src="scripts/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts/jquery.validate.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.pack.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts/jquery.scroll.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="scripts/custom.js"&gt;&lt;/script&gt; &lt;?php if(get_lang() =='en') {echo '&lt;script type="text/javascript" src="scripts/jquery-validate/val-en.js"&gt;&lt;/script&gt;';} ?&gt; &lt;?php if(get_lang() =='es') {echo '&lt;script type="text/javascript" src="scripts/jquery-validate/val-es.js"&gt;&lt;/script&gt;';} ?&gt; &lt;?php if(get_lang() =='zh-tw') {echo '&lt;script type="text/javascript" src="scripts/jquery-validate/val-zh-tw.js"&gt;&lt;/script&gt;';} ?&gt; &lt;?php if(get_lang() =='zh-cn') {echo '&lt;script type="text/javascript" src="scripts/jquery-validate/val-zh-cn.js"&gt;&lt;/script&gt;';} ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload