Welcome Guest, Not a member yet? Register   Sign In
View code that hurts your brain
#3

[eluser]xwero[/eluser]
DWYK???

Even if you have to do something quick, which isn't the case here as it's a blog post snippet, isn't it more logical to put stings outside the php code? To take it to the extreme lets say you use a template engine, you are not going to write
Code:
<p>{'Full name: '.$user['firstname'].' '.$user['lastname'].' Email: '.$user['email']}</p>
you write
Code:
<p>Full name: {$user['firstname']} {$user['lastname']} Email: {$user['email']}</p>
Why would that be different using php as a template engine?

And if a site goes multilanguage isn't it better to create language dependent views instead of making each individual text language dependent? What happens if an individual text in one language must be split in more pieces to have the same meaning?

And the question remains what if you want to use tags in the string
Code:
<p>&lt;?php echo '<span class="fn">Full Name: '.$user['firstname'].' '.$user['lastname'].'</span><br><span class="email">Email: '.$user['email'].'</span>';?&gt;</p>
Then you have tags in and outside php. I don't think that is a very good idea because it's inconsistent.


Messages In This Thread
View code that hurts your brain - by El Forum - 08-22-2008, 03:32 AM
View code that hurts your brain - by El Forum - 08-22-2008, 08:22 AM
View code that hurts your brain - by El Forum - 08-22-2008, 09:42 AM
View code that hurts your brain - by El Forum - 08-22-2008, 10:45 AM
View code that hurts your brain - by El Forum - 08-22-2008, 12:37 PM
View code that hurts your brain - by El Forum - 08-22-2008, 02:28 PM
View code that hurts your brain - by El Forum - 08-22-2008, 04:10 PM
View code that hurts your brain - by El Forum - 08-22-2008, 04:42 PM
View code that hurts your brain - by El Forum - 08-22-2008, 06:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB