Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
I believe I read someplace once that it is more efficient to have your php embedded in your HTML where required. Something to do with the amount of parsing that the engine has to do. However, to reiterate what Captain John W. Holmes said, using a templating engine does allow you to better manage the project especially in dealing with maintenance down the road. I personally prefer to let the business logic create XML and employ XSLT to do my Html rendering. It may not be the quickest or most memory efficient, but, in my humble opinion, it is one of the easiest to maintain. Jordan S. Jones Ryan A wrote: Hi everyone, Just a simple doubt and basically your opinion needed. I have an option box on a webpage and have around 10 options on it and have run into a doubt, which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Thanks, -Ryan -- I am nothing but a poor boy. Please Donate.. https://www.paypal.com/xclick/business=list%40racistnames.comitem_name=Jordan+S.+Jonesno_note=1tax=0currency_code=USD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Whats more efficient? ( echo ; or ?php echo ? )
Hi everyone, Just a simple doubt and basically your opinion needed. I have an option box on a webpage and have around 10 options on it and have run into a doubt, which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
Ryan A wrote: I have an option box on a webpage and have around 10 options on it and have run into a doubt, which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Use a template engine to separate your presentation from your logic. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Really just a matter of personal preference. If I have a mostly PHP page, I would use echo to print out chunks of HTML. If I have a mostly HTML page (or section of a page), I would use separate ?php ? sections within it. I doubt you'd notice any performance difference between the two so use whichever is easier for you to code. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
--- John W. Holmes [EMAIL PROTECTED] wrote: Use a template engine to separate your presentation from your logic. :) Isn't PHP a templating engine? :-) Chris = My Blog http://shiflett.org/ HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
Chris Shiflett wrote: --- John W. Holmes [EMAIL PROTECTED] wrote: Use a template engine to separate your presentation from your logic. :) Isn't PHP a templating engine? :-) Of course it is, but what's that got to do with separating presentation from logic (business logic)? Each one can be PHP code... :) Bad answer, I know, because his code could be a PHP template. I'm sure it's not, though. I just wanted to give a different answer from the many it doesn't matter answers. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whats more efficient? ( echo ; or ?php echo ? )
I'll just on the template bandwagon, I use smarty. (http://smarty.php.net) Rolf Brusletto phpExamples.net John W. Holmes wrote: Ryan A wrote: I have an option box on a webpage and have around 10 options on it and have run into a doubt, which is more efficient to do: 1. option value=1?php if($th_order==1){echo SELECTED; } ?Something1/option option value=2?php if($th_order==2){echo SELECTED; } ?Something2/option (or) 2. instead of having the ?php and ? mixed in the HTML is it better to echo/print the whole lines? Use a template engine to separate your presentation from your logic. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php