Question
I need to divide and see if there's remainder....
how can I do that.
specifically, I've got repeating sections that I need to style with a left
or right float. They're working fine, but I now need to insert a statement
that says:
if $i/2 has a remainder, print right
if $i/2 has no remainder, print left
Page is here:
http://demo.mediachurch.com/news.php
I currently have the following code to generate my news listings:
if ($gID == $newsGroup) { //if groupid in array matches newsGroup ID
if ($pid != $newsGroup) { //if past newsGroup ID matches current
newsGroup ID
if ($pid == 777) { //condition set at beginning
echo '<div id="'.$gName.'" class="newsList">';
echo '<h2>'.$gName.$i.'</h2>';//remove $i when done as it just shows
count
}
echo '<h3>'.$newsTitle.'</h3>';
echo $newsContent;
}
if ($pid == $newsGroup) { //if past newsGroup id matches current
newsGroup ID
echo '<h3>'.$newsTitle.'</h3>';
echo $newsContent;
}
$pid = $newsGroup; //set current newsgroup to past
}
Any optimization of code is also welcome. This was a hard oen to figure out
for me and I don't really care for so many nested If statements, but am too
tired rightnow to see a better way.
--
TIA,
Jon Parkhurst
PriivaWeb
http://priiva.net.
specifically, I've got repeating sections that I need to style with a left
or right float. They're working fine, but I now need to insert a statement
that says:
if $i/2 has a remainder, print right
if $i/2 has no remainder, print left
Page is here:
http://demo.mediachurch.com/news.php
I currently have the following code to generate my news listings:
if ($gID == $newsGroup) { //if groupid in array matches newsGroup ID
if ($pid != $newsGroup) { //if past newsGroup ID matches current
newsGroup ID
if ($pid == 777) { //condition set at beginning
echo '<div id="'.$gName.'" class="newsList">';
echo '<h2>'.$gName.$i.'</h2>';//remove $i when done as it just shows
count
}
echo '<h3>'.$newsTitle.'</h3>';
echo $newsContent;
}
if ($pid == $newsGroup) { //if past newsGroup id matches current
newsGroup ID
echo '<h3>'.$newsTitle.'</h3>';
echo $newsContent;
}
$pid = $newsGroup; //set current newsgroup to past
}
Any optimization of code is also welcome. This was a hard oen to figure out
for me and I don't really care for so many nested If statements, but am too
tired rightnow to see a better way.
--
TIA,
Jon Parkhurst
PriivaWeb
http://priiva.net.
