Page 1 of 1

Best Syntax

Posted: Thu Jun 09, 2011 1:23 pm
by unemployment
What is the best syntax for this? I don't even know if the last part of this works.

[syntax=php]$data[0][$k]['message'] = 'You have successfully joined <a href="../c/'.$r['companytag'].'">'.$r['feedfirstname'].'</a> in '.industry($r['industry']).' at '.stage($r['stage']).' stage'.if (empty($otherfans)){"."};[/syntax]

Re: Best Syntax

Posted: Thu Jun 09, 2011 1:46 pm
by Tino
Well, have you tried if it works? :?

That all looks fine except for the last part. You cannot use an if statement like that.

Re: Best Syntax

Posted: Thu Jun 09, 2011 1:50 pm
by unemployment
Tino wrote:Well, have you tried if it works? :?

That all looks fine except for the last part. You cannot use an if statement like that.


Yeah, the last part fails. Do you know how to properly write this?

Re: Best Syntax

Posted: Thu Jun 09, 2011 4:39 pm
by Tino
You would just do

[syntax=php]$string = 'my string';

if ( empty($otherfans) ) { $string .= '.'; }[/syntax]

obviously replacing 'my string' with what you put in the first post.