Mixed HTML and PHP in Echo

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
I'm personally not a fan of shortcodes. I've got to maintain a lot of legacy PHP code and the shortcodes become hard to read in larger files.

Then again I've been doing PHP for over 10 years.

That's my feeling as well, I'm glad I'm not the only one since kabel made it feel like I am.
 

_kabal_

Executive Member
Joined
Oct 24, 2005
Messages
5,923
To be clear I NEVER advocated for the use of short open tags, only short echo tags.

If you find your html littered with php tags, or your php littered with HTML strings, you are doing something wrong anyway. Obviously legacy code exists that is like this, but I see no point in doing this in any new code.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
To be clear I NEVER advocated for the use of short open tags, only short echo tags.

If you find your html littered with php tags, or your php littered with HTML strings, you are doing something wrong anyway. Obviously legacy code exists that is like this, but I see no point in doing this in any new code.

We will have to agree to disagree.
 

_kabal_

Executive Member
Joined
Oct 24, 2005
Messages
5,923
What did I say that you disagree with and why?

I think you have a bad case of the Dunning-Krugers
 
Last edited:

DA-LION-619

Honorary Master
Joined
Aug 22, 2009
Messages
13,777
If you're looking for performance, why aren't you doing this client side?
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
If you're looking for performance, why aren't you doing this client side?

Read the whole thread. Not looking for performance I merely asked kabel if there is a performance upside when using the short code version of echo as he suggested is the correct way instead compared to writing it out like I did.
 
Last edited:

DA-LION-619

Honorary Master
Joined
Aug 22, 2009
Messages
13,777
Read the whole thread. Not looking for performance I merely asked kabel if there is a performance upside when using the short code version of echo compared to writing it out like I did.
Shorter code is easier to read. I doubt there's a performance increase.

Anyway this should be done client side.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
What did I say that you disagree with and why?

I think you have a bad case of the Dunning-Krugers

Echo the shortcode version compared to the normal way.

And the part where you said if you have php in you html your doing it wrong.

By all means go to my thread file get contents and rewrite it "correctly" if it is wrong.

But I doubt it you come across as someone who want to force devs into doing things a certain way not because it's the best practice or ideal way but simply because it's the way YOU do it.

Maybe I'm wrong, maybe I'm miss labeling you, I don't know.
 
Last edited:

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
Shorter code is easier to read. I doubt there's a performance increase.

Anyway this should be done client side.

You want me to put that in Javascript?

I highly doubt that's the way to go,

#1 Javascript is a luxury so won't work if the client doesn't allow it secondly how is Javascript suppose to read and write to the dB?
 

DA-LION-619

Honorary Master
Joined
Aug 22, 2009
Messages
13,777
You want me to put that in Javascript?

I highly doubt that's the way to go,

#1 Javascript is a luxury so won't work if the client doesn't allow it secondly how is Javascript suppose to read and write to the dB?
What are you writing to the db?
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
I'm discussing what's in this thread.

First post.

Your discussing something that's not relevant as kabel's argument was OT.

Nod gave the solution to my OP. This thread can be closed.
 

rward

Senior Member
Joined
Oct 26, 2007
Messages
865
You want me to put that in Javascript?

I highly doubt that's the way to go,

#1 Javascript is a luxury so won't work if the client doesn't allow it secondly how is Javascript suppose to read and write to the dB?

1.3% of browsers on the web don't use JavaScript or have it disabled...

It's no longer a 'luxury'
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
1.3% of browsers on the web don't use JavaScript or have it disabled...

It's no longer a 'luxury'

This is a php thing I can't do this in javascript and would prefer not to have it in JS either.

Like I said this is OT my OP has been answered perfectly.
 

semaphore

Honorary Master
Joined
Nov 13, 2007
Messages
15,201
This is a php thing I can't do this in javascript and would prefer not to have it in JS either.

Like I said this is OT my OP has been answered perfectly.

Well technically you can do it in javascript. Server side.
 

Thor

Honorary Master
Joined
Jun 5, 2014
Messages
44,236
Well technically you can do it in javascript. Server side.

True, but one step at a time.

I want to end up as nodejs dev but still a long way to go so will stick to php for now.
 
Top