I was sitting and looking at my code a second ago when it hit me that there must be a better way to write it, but I just don't know how to. I decided I'd ask a community of more experienced developers to see what kind of input you might have... For now I'm just glancing through docs to get an idea, but I'd love an outside opinion.
Like I said, I'm not great with php and I really only use it for very basic needs. But I'd like to move past that. Programming has become really fascinating to me lately.
Anyways, here's the code:
Code: Select all
<?php
$dp = $_GET['dp'];
echo ($dp == (c) ? $this->render( 'casualButtons' ) : '');
echo ($dp == (s) ? $this->render( 'seriousButtons' ) : '');
echo ($dp != (c) && $dp != (s) ? $this->render( 'buttons' ) : '');
?>
So yeah, it finds out what $dp is, then determines what to do accordingly using some ternary operators. There has to be a way to condense this though... It seems so redundant.
Thanks for any input!