2013-03-15 00:26
Witam, mam problem typowo programistyczny i nie wiem jak to rozwiązać.... chodzi o sposób wyświetlania produktów plik products.php
$content .= '<div class="span4"><li class="l' .( ( $i == ( $iCount - 1 ) ) ? 'L' : $i + 1 ). ' i' .( ( $i % 2 ) ? 0 : 1 ). ' column' .( ( $i % 3 ) ? 0 : 1 ). '">' .( isset( $aData [ 'iAvarageVotes' ] ) ? '<div class="ratingList stars' . $aData [ 'iAvarageVotes' ]. '"> </div>' : null ). ' <h2><a href="' . $aData [ 'sLinkName' ]. '">' . $aData [ 'sName' ]. '</a></h2> ' .( isset( $GLOBALS [ 'aDisplayPagesTreeInProductsList' ][ $iPage ] ) ? '<h3>' . $this -> throwProductsPagesTree ( $aData [ 'iProduct' ] ). '</h3>' : null ). $sImage . $sDescription ; if( is_numeric ( $aData [ 'mPrice' ] ) ){ if( isset( $sBasketPage ) ){ $content .= '<div class="basket"><a href="' . $sBasketPage . '&iProductAdd=' . $aData [ 'iProduct' ]. '&iQuantity=1" rel="nofollow" title="' . $lang [ 'Basket_add' ]. ': ' . $aData [ 'sName' ]. '">' . $lang [ 'Basket_add' ]. '</a></div>' ; } $content .= '<div class="price"><em>' . $lang [ 'Price' ]. ':</em><strong>' . displayPrice ( $aData [ 'mPrice' ] ). '</strong><span>' . $config [ 'currency_symbol' ]. '</span>' .( isset( $aData [ 'fPriceNetto' ] ) ? '<div class="priceNetto"><em>' . $lang [ 'Netto' ]. ':</em><strong>' . $aData [ 'sPriceNetto' ]. '</strong><span>' . $config [ 'currency_symbol' ]. '</span>(' . $lang [ 'Vat' ]. ' ' . $config [ 'vat' ]. '%)</div>' : null ). '</div>' ; } else{ $content .= '<div class="noPrice"><strong>' . $aData [ 'mPrice' ]. '</strong></div>' ; } $content .= '</li></div>' ;
To jest kod który wyświetla po kolei listę produktów .... Wyświetla je w formie cyklicznie powtarzających się <li> </li> ... co trzeci ma klasę column1 Próbuję zrobić tak żeby objać jakimś divem 3 elementy li. I tak do końca, czyli np <div class="wrapper"> <li class="l1"> ... szczegóły produktu </li> <li class="l2"> ... szczegóły produktu </li> <li class="l3"> ... szczegóły produktu </li> <div> <div class="wrapper"> <li class="l4"> ... szczegóły produktu </li> <li class="l5"> ... szczegóły produktu </li> <li class="l6"> ... szczegóły produktu </li> <div> itd.... nie jest problemem objąć takim dive wszystkie elementy li, ale w grupach co 3 - normalnie nie mogę nic wymyślić .... mozna prosić o jakąś wskazówkę? pozdrawiam serdecznie
» Quick.Cart v6.x 2013-03-15 00:29
próbowałem jsem dodawać element <div class="wrapper"> przed każdym elementem <li class="column1"> a potem je domykać na co drugim <li class="column0"> ale sama idea jest tak toporna że aż woła o pomstę do nieba, dlatego zdecydowałem się napisać ;)
2013-03-15 14:08
udało mi się żeby co 3 elementy były zgrupowane ale nie działa jak trzeba dalej już nie dojdę, moge prossić o jakis suport ? ;( strona http://testystron.laohost.net/qc6/ kod
$r= 3 ; for( $i = $aKeys [ 'iStart' ]; $i < $aKeys [ 'iEnd' ]; $i ++ ){ $aData = $this -> aProducts [ $aProducts [ $i ]]; $sDescription = null ; $sImage = null ; $this -> throwProductVotes ( $aData ); if( !empty( $aData [ 'sDescriptionShort' ] ) ){ $aData [ 'sDescriptionShort' ] = changeTxt ( $aData [ 'sDescriptionShort' ], 'nlNds' ); $sDescription = '<div class="description">' . $aData [ 'sDescriptionShort' ]. '</div>' ; } if( isset( $oFile ) ){ $sImage = $oFile -> getDefaultImage ( $aData [ 'iProduct' ], 2 , true , $aData [ 'sLinkName' ] ); } $content .= "<div class='row-fluid'>" ; for( $j = 0 ; $j < $r ; ++ $j ){ $content .= '<div class="span4"><li class="l' .( ( $i == ( $iCount - 1 ) ) ? 'L' : $i + 1 ). ' i' .( ( $i % 2 ) ? 0 : 1 ). ' column' .( ( $i % 3 ) ? 0 : 1 ). '">' .( isset( $aData [ 'iAvarageVotes' ] ) ? '<div class="ratingList stars' . $aData [ 'iAvarageVotes' ]. '"> </div>' : null ). ' <h2><a href="' . $aData [ 'sLinkName' ]. '">' . $aData [ 'sName' ]. '</a></h2> ' .( isset( $GLOBALS [ 'aDisplayPagesTreeInProductsList' ][ $iPage ] ) ? '<h3>' . $this -> throwProductsPagesTree ( $aData [ 'iProduct' ] ). '</h3>' : null ). $sImage . $sDescription ; if( is_numeric ( $aData [ 'mPrice' ] ) ){ if( isset( $sBasketPage ) ){ $content .= '<div class="basket"><a href="' . $sBasketPage . '&iProductAdd=' . $aData [ 'iProduct' ]. '&iQuantity=1" rel="nofollow" title="' . $lang [ 'Basket_add' ]. ': ' . $aData [ 'sName' ]. '">' . $lang [ 'Basket_add' ]. '</a></div>' ; } $content .= '<div class="price"><em>' . $lang [ 'Price' ]. ':</em><strong>' . displayPrice ( $aData [ 'mPrice' ] ). '</strong><span>' . $config [ 'currency_symbol' ]. '</span>' .( isset( $aData [ 'fPriceNetto' ] ) ? '<div class="priceNetto"><em>' . $lang [ 'Netto' ]. ':</em><strong>' . $aData [ 'sPriceNetto' ]. '</strong><span>' . $config [ 'currency_symbol' ]. '</span>(' . $lang [ 'Vat' ]. ' ' . $config [ 'vat' ]. '%)</div>' : null ). '</div>' ; } else{ $content .= '<div class="noPrice"><strong>' . $aData [ 'mPrice' ]. '</strong></div>' ; } $content .= '</li></div>' ; } $content .= "</div>\n" ; } // end for
2013-03-17 15:05
....
2013-03-18 19:33
czy ktoś tu żyje ? ;)
2013-03-18 21:46
Spróbuj tak:
$i2 = 0 ; $i3 = 2 ; for( $i = $aKeys [ 'iStart' ]; $i < $aKeys [ 'iEnd' ]; $i ++ ){ $aData = $this -> aProducts [ $aProducts [ $i ]]; $sDescription = null ; $sImage = null ; if( !empty( $aData [ 'sDescriptionShort' ] ) ){ $aData [ 'sDescriptionShort' ] = changeTxt ( $aData [ 'sDescriptionShort' ], 'nlNds' ); $sDescription = '<div class="description">' . $aData [ 'sDescriptionShort' ]. '</div>' ; } if( isset( $oFile ) ){ $sImage = $oFile -> getDefaultImage ( $aData [ 'iProduct' ], 2 , true , $aData [ 'sLinkName' ], $iPage ); } $content .= ( ( $i == $i2 ) ? '<div class="wrapper">' : null ). '<li class="l' .( ( $i == ( $iCount - 1 ) ) ? 'L' : $i + 1 ). ' i' .( ( $i % 2 ) ? 0 : 1 ). ' column' .( ( $i % 3 ) ? 0 : 1 ). '"> <h2><a href="' . $aData [ 'sLinkName' ]. '">' . $aData [ 'sName' ]. '</a></h2> ' .( isset( $GLOBALS [ 'aDisplayPagesTreeInProductsList' ][ $iPage ] ) ? '<h3>' . $this -> throwProductsPagesTree ( $aData [ 'iProduct' ] ). '</h3>' : null ). $sImage . $sDescription ; if( is_numeric ( $aData [ 'mPrice' ] ) ){ if( isset( $sBasketPage ) ){ $content .= '<div class="basket"><a href="' . $sBasketPage . '&iProductAdd=' . $aData [ 'iProduct' ]. '&iQuantity=1" rel="nofollow" title="' . $lang [ 'Basket_add' ]. ': ' . $aData [ 'sName' ]. '">' . $lang [ 'Basket_add' ]. '</a></div>' ; } $content .= '<div class="price"><em>' . $lang [ 'Price' ]. ':</em><strong>' . displayPrice ( $aData [ 'mPrice' ] ). '</strong><span>' . $config [ 'currency_symbol' ]. '</span></div>' ; } else{ $content .= '<div class="noPrice"><strong>' . $aData [ 'mPrice' ]. '</strong></div>' ; } $content .= '</li>' .( ( $i == $i3 ) ? '</div>' : null ); ( $i == $i3 ) ? $i2 += 3 : null ; ( $i == $i3 ) ? $i3 += 3 : null ; } // end for
simlution.org 2013-03-18 22:50
Muszę to powiedzieć - stary miód nie kod normalnie, zajebiści jesteście :D :D szkoda że jest zbyt durny żeby na to sam wpaść, ale prędzej bym jajo zniósł niż wymyślił żę tak można.... niemniej pięknę dzięki wszystko śmiga jak przecinak, super, piwko leci