Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #17378
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.php |
| Subject | Re: Is this just a question of personal prefs - echo or not? |
| Date | Tue, 25 Apr 2017 14:21:45 +0100 |
| Organization | A noiseless patient Spider |
| Lines | 22 |
| Message-ID | <8737cwzkpi.fsf@bsb.me.uk> (permalink) |
| References | <odnc5b$c2c$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | mx02.eternal-september.org; posting-host="0a63096f724e281cbdaa7cfd517e43be"; logging-data="24168"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19dwNvtA1dQjGaVHvyUdOlnkySnY42N1Nc=" |
| Cancel-Lock | sha1:6f3WHMeBvyErGK42g4BErsaqUzA= sha1:0x55Y8wwbr55FPWn/TYu2Te1dyU= |
| X-BSB-Auth | 1.00528a930c7e3a1ed4e8.20170425142145BST.8737cwzkpi.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.php:17378 |
Show key headers only | View raw
TimW <tim@mysurname.me.uk> writes:
> I am teaching myself php very slowly as I go along so bear with me pls.
>
> I am making a theme for the cms I am using. There are two page templates and I want to be able to style elements differently according to which template is in use, so hopefully this line is fairly self explanatory:
>
> <body <?php if ($template_file != 'homepage.php')
> { echo "class =\"subpage\"";} ?> >
>
> And it works, fine, but I don't think it would normally be done that way. Is this better?
>
> <body <?php if ($template_file != 'homepage.php')
> {?> class ="subpage" <?php } ?> >
>
> or just different? Is one more acceptable or normal or easier to read?
I find both rather fussy. Here's yet another way:
<body<?= $template_file != 'homepage.php' ? ' class=subpage' : '' ?>>
--
Ben.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is this just a question of personal prefs - echo or not? TimW <tim@mysurname.me.uk> - 2017-04-25 12:36 +0100
Re: Is this just a question of personal prefs - echo or not? Tim Streater <timstreater@greenbee.net> - 2017-04-25 13:10 +0100
Re: Is this just a question of personal prefs - echo or not? "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-04-25 15:00 +0200
Re: Is this just a question of personal prefs - echo or not? Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-25 08:19 -0400
Re: Is this just a question of personal prefs - echo or not? Richard Yates <richard@yatesguitar.com> - 2017-04-25 21:06 -0700
Re: Is this just a question of personal prefs - echo or not? Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-26 07:55 -0400
Re: Is this just a question of personal prefs - echo or not? Richard Yates <richard@yatesguitar.com> - 2017-04-26 09:15 -0700
Re: Is this just a question of personal prefs - echo or not? Jerry Stuckle <jstucklex@attglobal.net> - 2017-04-26 12:48 -0400
Re: Is this just a question of personal prefs - echo or not? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-26 20:40 +0200
Re: Is this just a question of personal prefs - echo or not? "Christoph M. Becker" <cmbecker69@arcor.de> - 2017-04-25 15:03 +0200
Re: Is this just a question of personal prefs - echo or not? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-26 03:14 +0200
Re: Is this just a question of personal prefs - echo or not? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-04-25 14:21 +0100
Re: Is this just a question of personal prefs - echo or not? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-04-26 03:10 +0200
Re: Is this just a question of personal prefs - echo or not? TimW <tim@mysurname.me.uk> - 2017-04-26 19:31 +0100
Re: Is this just a question of personal prefs - echo or not? Tim Streater <timstreater@greenbee.net> - 2017-04-26 20:21 +0100
csiph-web