CodeIgniter Forums
Can you insert an if condition in a view file? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Can you insert an if condition in a view file? (/showthread.php?tid=29686)

Pages: 1 2


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]titanite[/eluser]
Hi guys!

You were right, it was the short tags. I have learnt my lesson.. am not using short tags anymore. Once I change everything to below.. it worked like magic. I still don't know why some short tags work others don't.
But I will be using <?php from now on to ensure the portability of the code.

Code:
<title><?php echo "$info->title"; ?></title>
</head>
<body>
<h1>&lt;?php echo "$info->title"; ?&gt;</h1>
    
<h2>Title: &lt;?php echo "$info->title"; ?&gt;</h2>
<h2>Marketed title: &lt;?php echo "$info->title_marketed"; ?&gt;</h2>
<h3>Directed by: &lt;?php echo "$info->director_1"; ?&gt;&lt;?php if($info->director_2) { echo ", $info->director_2";} ?&gt;</h3>
<p>Review:</p>
<p>&lt;?php echo "$info->text;"?&gt;</p>


<p>Written by author &lt;?php echo "$info->author"; ?&gt;</p>
<p>on date &lt;?php echo "$info->date" ?&gt;</p>

Thanks for your help! Smile


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]The Wizard[/eluser]
[quote author="titanite" date="1271636231"]Hi guys!

You were right, it was the short tags. I have learnt my lesson.. am not using short tags anymore. Once I change everything to below.. it worked like magic. I still don't know why some short tags work others don't.
But I will be using &lt;?php from now on to ensure the portability of the code.

Code:
&lt;title&gt;&lt;?php echo "$info->title"; ?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
<h1>&lt;?php echo "$info->title"; ?&gt;</h1>
    
<h2>Title: &lt;?php echo "$info->title"; ?&gt;</h2>
<h2>Marketed title: &lt;?php echo "$info->title_marketed"; ?&gt;</h2>
<h3>Directed by: &lt;?php echo "$info->director_1"; ?&gt;&lt;?php if($info->director_2) { echo ", $info->director_2";} ?&gt;</h3>
<p>Review:</p>
<p>&lt;?php echo "$info->text;"?&gt;</p>


<p>Written by author &lt;?php echo "$info->author"; ?&gt;</p>
<p>on date &lt;?php echo "$info->date" ?&gt;</p>

Thanks for your help! Smile[/quote]

1. get a mac Smile
2. install mamp
3. install textmate
4. continue to use shorttagsSmile
5. take care!


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]cahva[/eluser]
Hehe.. Its really not a WAMP or XAMPP(or MAMP) issue. They all are just frontends to PHP and Mysql. They use the same PHP and Mysql binaries. All they do is install the software and write your config files for you so you dont have to edit those with a text editor(usually Smile ), nothing else.


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]cahva[/eluser]
[quote author="herrkaleun" date="1271636315"]
1. get a mac Smile
2. install mamp
3. install textmate
4. continue to use shorttagsSmile
5. take care![/quote]

You forgot:
3. BUY and install textmate

Tongue

Damn. Do I have to buy an expensive mac just to use short tags. LOL Smile


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]The Wizard[/eluser]
[quote author="cahva" date="1271638774"]Hehe.. Its really not a WAMP or XAMPP(or MAMP) issue. They all are just frontends to PHP and Mysql. They use the same PHP and Mysql binaries. All they do is install the software and write your config files for you so you dont have to edit those with a text editor(usually Smile ), nothing else.[/quote]

hell yess!!Smile
that IS the point.
in the apple world everything comes pre-configured (almost) and everything works out of the box!
so you don't have to tangle with the configs and stuff.
i love it!

good night everybody Smile


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]The Wizard[/eluser]
[quote author="cahva" date="1271638955"][quote author="herrkaleun" date="1271636315"]
1. get a mac Smile
2. install mamp
3. install textmate
4. continue to use shorttagsSmile
5. take care![/quote]

You forgot:
3. BUY and install textmate

Tongue

Damn. Do I have to buy an expensive mac just to use short tags. LOL Smile[/quote]

yes that's true!Smile))
i worked my hands off to get one, but now i do! It truely is amazing.
i can only recommend it to anyone!Smile

take care friends!


Can you insert an if condition in a view file? - El Forum - 04-18-2010

[eluser]slowgary[/eluser]
herrkaleun makes commission on MacBook Pro sales!!!


Can you insert an if condition in a view file? - El Forum - 04-19-2010

[eluser]The Wizard[/eluser]
[quote author="slowgary" date="1271666295"]herrkaleun makes commission on MacBook Pro sales!!![/quote]

Smile))
no i just recommend you what really is good. Smile