Welcome Guest, Not a member yet? Register   Sign In
End function
#1

[eluser]jav99[/eluser]
Hey there, am wondering: is it possible to use if(end) using the code igniter way to write php?

am interested that instead of writing this:

Code:
<?php if (end($item) == $item_row)
  {    echo ‘last’;
  }?>
<? else: ?><? endif;?>

i could use the code igniter way of doing things like this

Code:
<?php if (end($item) == $item_row):?>

< p > last </ p >
&lt;? else: ?&gt;&lt;? endif;?&gt;

is this possible?
#2

[eluser]cahva[/eluser]
This is not CI specific and is supported natively in PHP, so sure you can use it.
#3

[eluser]jav99[/eluser]
[quote author="cahva" date="1263596444"]This is not CI specific and is supported natively in PHP, so sure you can use it.[/quote]

thanks for ur reply, what i wanted to know is that if there was a CI equivalent, since the html code is cleaner using the CI way using simple CI if statements.
#4

[eluser]cahva[/eluser]
Sorry, but I dont understand. CI is PHP and you can build the html code the same way. You can get out of PHP anytime with ?&gt; and insert html between and then start it again later. Is this what you were after?
#5

[eluser]jav99[/eluser]
[quote author="cahva" date="1263597856"]Sorry, but I dont understand. CI is PHP and you can build the html code the same way. You can get out of PHP anytime with ?&gt; and insert html between and then start it again later. Is this what you were after?[/quote]

using if statements in CI u get a very elegant coding layout

Code:
&lt;? if ---?&gt;

html code goes here, plus some more php bits

&lt;? else:?&gt;

&lt;? end if;?&gt;

very elegant and easy to read and understand.
#6

[eluser]cahva[/eluser]
Yes, and I told you its not CI specific. You can do that in normal PHP script no problemo.




Theme © iAndrew 2016 - Forum software by © MyBB