Welcome Guest, Not a member yet? Register   Sign In
View not executing PHP code
#1

[eluser]HooJee[/eluser]
Hi Guys

I cannot execute PHP code in my view files. The controllers on the other hand work perfectly fine. I am using WAMP 2.0
#2

[eluser]kgill[/eluser]
It would be helpful to see the code in the view and the controller, also are you getting any error messages? If you want help you have to give us a little more info. Smile
#3

[eluser]HooJee[/eluser]
The code is pretty straightforward. See below:

// home.php controller
Code:
<?php
class Home extends Controller {

    function index()
    {
        $this->load->view('homeview');
    }
}
?>

//homeview.php
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;title&gt;&lt;? echo "testing"?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;/body&gt;
  &lt;!-- some stuff --&gt;
&lt;/body&gt;
&lt;/html&gt;
#4

[eluser]wabu[/eluser]
Is short_open_tag enabled in php.ini (http://us3.php.net/manual/en/ini.core.php)? You might try using "&lt;?php" in your template first to see if that works.
#5

[eluser]HooJee[/eluser]
Oh yes! Silly me, how could I forget. BTW, I have noticed people do the following to get the base url:
&lt;?=base_url?&gt;

Whenever I try it I get a blank. It'll only work if I use echo. Do you know why this could be happening?
#6

[eluser]jayrulez[/eluser]
[quote author="HooJee" date="1248563896"]Oh yes! Silly me, how could I forget. BTW, I have noticed people do the following to get the base url:
&lt;?=base_url?&gt;

Whenever I try it I get a blank. It'll only work if I use echo. Do you know why this could be happening?[/quote]

for d same reason above




Theme © iAndrew 2016 - Forum software by © MyBB