Help with some code needed!
Posted: Wed Mar 12, 2008 1:42 am
GDay All,
Would someone be so kind and step me through the following piece of code:
I am getting lost as to what this piece of code is doing.
As I read it, it first checks for an empty entry, then if the entry is NOT empty, sets the 'visibility' attribute and adds a variable and then displays the entry.
This is where I get lost though:
Exactly what is happening in this line? In particular, what does the ? mean in this context.
Any help would be greatly appreciated.
Would someone be so kind and step me through the following piece of code:
Code: Select all
if($easygbConfig_show_homepage && (!empty($row->homepage))) {
$tmpl->setAttribute('show_homepage', 'visibility', 'visible');
$tmpl->addVar('show_homepage', 'HOMEPAGE', (substr($row->homepage, 0, 4) != 'http' ? 'http://' . $row->homepage : $row->homepage));
$tmpl->addVar('show_homepage', 'EASYGB_VISIT_WEBSITE', EASYGB_VISIT_WEBSITE);
}
As I read it, it first checks for an empty entry, then if the entry is NOT empty, sets the 'visibility' attribute and adds a variable and then displays the entry.
This is where I get lost though:
Code: Select all
$tmpl->addVar('show_homepage', 'HOMEPAGE', (substr($row->homepage, 0, 4) != 'http' ? 'http://' . $row->homepage : $row->homepage));
Any help would be greatly appreciated.