http://newyork.yankees.mlb.com/nyy/ballpark/guide.jsp
Pravim slican index pojmova ali u 2 kolone.
U svakom slucaju imam problema. Napravim podelu, ali samo za parne brojeve... Zatim kolone mi nisu jednake , ko u primeru jer recimo vrsim podelu po broju reci, pa ima recimo vise slova u drugoj koloni sto je izduzuje...
Znaci trebalo bi da kolone budu skoro jednake duzine, ali i da reci istog slova budu u jednoj koloni, a ne kao kod mene gde se reci slova I prebace i u drugoj koloni...
Mogu da napisem sta sam radio, mada nije dobro.. Napomena $all_record ranije cupa broj polja u tabeli i naravno $index_words kupi sadrzaj tabele i ispisuje..
Code:
<div class="index_word_all">
<?php
// values for half page
$half_page=(int) (($all_record)/2);
$counts=1;
$letter='';
?>
<div class="index_word">
<?php foreach ($index_words as $word):
// In that place we monitor if Letter is same. If answer is Yes, print all words of that letter
if ($word->getLetter()!= $letter):?>
<a name="<?php echo $word->getLetter(); ?>" class="letter">
<?php echo $word->getLetter(); ?>
</a>
<?php $letter =$word->getLetter();?>
<?php endif;?>
<a href="#<?php echo $word->getWord(); ?>"><?php echo $word->getWord(); ?></a><br/>
<?php if ((( ceil($all_record / ($counts) )) == 2 ) && ( $counts == $half_page)) :
echo '</div><!--end_first_half-->
<div class="index_word">';
endif;
$counts++;
?>
<?php endforeach; ?>
</div>
<div class="index_word_all">
<?php
// values for half page
$half_page=(int) (($all_record)/2);
$counts=1;
$letter='';
?>
<div class="index_word">
<?php foreach ($index_words as $word):
// In that place we monitor if Letter is same. If answer is Yes, print all words of that letter
if ($word->getLetter()!= $letter):?>
<a name="<?php echo $word->getLetter(); ?>" class="letter">
<?php echo $word->getLetter(); ?>
</a>
<?php $letter =$word->getLetter();?>
<?php endif;?>
<a href="#<?php echo $word->getWord(); ?>"><?php echo $word->getWord(); ?></a><br/>
<?php if ((( ceil($all_record / ($counts) )) == 2 ) && ( $counts == $half_page)) :
echo '</div><!--end_first_half-->
<div class="index_word">';
endif;
$counts++;
?>
<?php endforeach; ?>
</div>
Tacnije bitan je ovaj uslov:
Code:
<?php if ((( ceil($all_record / ($counts) )) == 2 ) && ( $counts == $half_page)) :
echo '</div><!--end_first_half-->
<div class="index_word">';
endif;
<?php if ((( ceil($all_record / ($counts) )) == 2 ) && ( $counts == $half_page)) :
echo '</div><!--end_first_half-->
<div class="index_word">';
endif;
Jel ima neko ideju kako se resava primer sa gornjeg linka??