Welcome Guest, Not a member yet? Register   Sign In
"<?=" is not work?
#1

[eluser]fRkSsK[/eluser]
hi
when i write;

<?= anchor('application', 'The Application');?>
or
<?= base_url();?>
or..

it does not work. php doesn't work. source code is shown same "<?= base_url();?>"

but when i write example <?php echo 'hello' ?> is work.

so What i must do for this problem?
#2

[eluser]umefarooq[/eluser]
hi check your phpinf() there is short_open_tag is on or not if not on than go to your php.ini file and edit short_open_tag on its will work fine if you are using wamp u can enable it just right click on wamp icon on you taskbar.
#3

[eluser]fRkSsK[/eluser]
thanks.
yes i opened "short_open_tag" in wamp. but another error:

Fatal error: Call to undefined function anchor() in C:\wamp\www\system\application\views\header.php on line 34

Code:
line 34: <?= anchor('application', 'The Application');?>
#4

[eluser]umefarooq[/eluser]
yes you have to call uri helper for this you can do in two ways edit your autoload.php file and put ther or either load in your controller like $this->load->helper('uri'); its better to put in autoload so it will be available to you any time.
#5

[eluser]fRkSsK[/eluser]
yes.

i change autoload.php file. and it's ok.

now, when i write this in header.php;
Code:
<title><?= $title;?></title>

and my aboutus controller is;
Code:
function index(){
        
        $data['title'] = "bla bla bla";
        $this->load->view('aboutus');
        
    }

but my title is not change.

Code:
A PHP Error was encountered

Severity: Notice
Message:  Undefined variable: title
Filename: views/header.php
Line Number: 6
#6

[eluser]umefarooq[/eluser]
hi also pass your data to view ur not passing data pass it like this

$this->load->view('aboutus',$data);

than view will understand what is $title.
#7

[eluser]fRkSsK[/eluser]
you're gorgeous. thanks ömer faruk.
#8

[eluser]umefarooq[/eluser]
hi if you want to learn more about CI do visit and put your problem here and try to solve others problem you will also learn alot
#9

[eluser]Colin Williams[/eluser]
Kumbaya, my Lord. Kumbaya. Kumbaya, my Lord. Kumbaya. Kumbaya my Lord. Kumbaya. Oh Lord, Kumbaya...

RTFM, my Lord. RTFM... Smile
#10

[eluser]johnwbaxter[/eluser]
What percentage of your million posts have been taken up by you being a bit of a wanker Colin?

He obviously has read some of the manual or he wouldn't have written any Ci code would he, perhaps he was just struggling with his level of knowledge. I know i asked some pretty dense questions when i started with CI even though i had read the user guide about a squillion times.




Theme © iAndrew 2016 - Forum software by © MyBB