0

I have this showing up on my site. the lang function is showing on the web, but not runned as it should run on the site. The server is running nginx

Q: Why is it doing that, and how can it be prevented?

enter image description here

content of file:

    <?

function lang($line) {

    $ci = & get_instance();
    $languageVariable = explode(" ", $line);
    $outcome = '';
        foreach($languageVariable as $langLine) {
        $outcome .= $ci->lang->line($langLine);

        }
        return $outcome;


}

function langW($string, $var1 = FALSE, $var2 = FALSE, $var3 = FALSE)
{
    return sprintf(lang($string), ($var1 ? $var1 : ''), ($var2 ? $var2 : ''));
}



function langV($line, $var)
{
    $ci = & get_instance();
    return sprintf($ci->lang->line($line), $var);
}
11
  • Make sure you have Apache running or other web server Commented Aug 25, 2015 at 8:42
  • If there is an error, please paste it as text. When you do, also paste it in Google. You're likely not the first one who's got it. Commented Aug 25, 2015 at 8:42
  • 2
    <? make this to <?php , it will definately work :) Commented Aug 25, 2015 at 8:44
  • 1
    sorry not related to this question , dude your name @HawasKaPujaari :P Commented Aug 25, 2015 at 8:49
  • 1
    @n01ze Sshhh! Angrezo ko pata chal jayega ;) Commented Aug 25, 2015 at 8:50

1 Answer 1

4

Make sure you have:

short_open_tag=On

in php.ini, then restart your nginx server

http://php.net/manual/en/ini.core.php#ini.short-open-tag

If you can't edit php.ini, then you can either replace all your <? to <?php (not the best..) or add the following to the .htaccess file in your document root:

php_value short_open_tag 1

Remember that your hosting could have disabled this option, so it's not 100% guaranteed that the .htaccess way works.

Sign up to request clarification or add additional context in comments.

3 Comments

Just to note (although, this pretty much depends on the person), it's not fully impracticle to use <?php, as you can still use <?, but it will be short for <?php echo. Again, this is a matter of personal preference, but it does speed things up, especilly if you're doing Object Oriented PHP
<? is not a shorthand for <?php echo; did you mean <?=?
I'll correct it.. ASP made me forget of the little things PHP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.