CodeIgniter Forums
I can see php codes in html output - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: I can see php codes in html output (/thread-14839.html)



I can see php codes in html output - El Forum - 01-16-2009

[eluser]ApranaxFortress[/eluser]
I was write my codes in Linux and i'd copy my files into windows (with wamp server) but when i open my project i can see php codes in browser


This is html output of my project.
Code:
<html>
<head>
<title>A site</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
[removed][removed]


[removed][removed]
<link rel="stylesheet" type="text/css" href="<?=base_url()?>theme/theme.css">
</head>
<body>
<div id="first_div">
<div id="header_div">
  <a href="&lt;?=site_url(">Register</a> - <a href="&lt;?=site_url(">Login</a>  - <a href="&lt;?=site_url(">Logout</a> - <a href="&lt;?=site_url(">New Signal</a>

  <br/>&lt;?=$this->session->userdata('username');?&gt;
  </div>
<div id="container_div"> </div>
<div id="footer_div">Footer text</div>
</div>
&lt;/body&gt;
&lt;/html&gt;



I can see php codes in html output - El Forum - 01-16-2009

[eluser]Tom Schlick[/eluser]
do you have php enabled and running? try turning short tags on or in the config have it rewrite the short tags


I can see php codes in html output - El Forum - 01-16-2009

[eluser]ApranaxFortress[/eluser]
I changed this line in config

$config['rewrite_short_tags'] = TRUE; (it was false :red: )

My problem is solved now. Thank you for your help.


I can see php codes in html output - El Forum - 01-16-2009

[eluser]Tom Schlick[/eluser]
not a problem. im glad it was something simple and not some error which we couldnt help solve. now you can use it this way or if you wanna turn on short tags in the php config im pretty sure it will save you some slight resources but thats up to you. good luck with what your working on!


I can see php codes in html output - El Forum - 01-17-2009

[eluser]meridimus[/eluser]
I use short tags too, CI used to advise to turn it on but now they suggest you leave it off and instead of using:

Code:
&lt;?=$variable?&gt;

It's advised to do

Code:
&lt;?php echo $variable; ?&gt;

But, of course just do what you prefer. I prefer the short-hand of short-tags