Jump to content

Can someone explain what this tiny code snippet does?


hippypink

Recommended Posts

 echo '<div id="thankyou_container" style=\\"text-align:left;padding:0px;\\">
<div id="container" style=\\"text-align:left;padding:0px;\\">' . ($_SESSION['iframe'] ? '<div id="logo_phone_menu"><img alt="logo" border="0" hspace="0" src="theme/' . $_SESSION['t'] . '/header.gif" vspace="0"/></div>' : '');

 

This code might have mistakes (since its not working).

I realize that it is supposed to print some variables on to the page.  But am new to PHP, and not sure about the question mark and colon thing.  Any references to simple tutorials on this would be helpful too.  thanks

as it says it seems like a thankyou container for a website that contains an iframe which will display certain code depending on the value and if that value is not what it is supposed to be then it will display nothing.

It uses ternary operators. But basically.. As far as I can see it echos a bit of HTML, which includes session variables. If they're logged in, then it displays the custom theme (note the absolute path).

 

That code is messy and not really supposed to be done that way, PHP variables should be wrapped in HTML not echo'd and escaped so much like so.

 

? is a ternary operator.

; is a new line.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.