JurKa Posted May 17, 2003 Report Share Posted May 17, 2003 vajag taadu funkciju kas izmet komentu skaitu linkaa tipo [1-5] [5-10] un tad tas links ved uz naakamo lapu, dabuuju taa lai izmet linku ar naakamaas lapas nr bet shitaa nesanaaca!! tipo tas domaats guestbookam! Paldies ceru ka kaads paliidzees :o Link to comment Share on other sites More sharing options...
Venom Posted May 17, 2003 Report Share Posted May 17, 2003 $count=??;//cik vispār komentu; $bum=5; //pa cik grupēt $n=ceil($count/$bum); //cik būs "lapu" for ($x=0;$x<=$n;$x++) { echo '['.($x*$bum).'-'.(($x==$n)?($count):(($x+1)*$bum)).'] '; } Link to comment Share on other sites More sharing options...
JurKa Posted May 19, 2003 Author Report Share Posted May 19, 2003 tur kaut kas neshancee!! man sanaak ka saak nevis [1-5], bet [5-10] un ja ir teiksim 23 komenti tad sanaak shitaa [20-25] [25-23] njez kas tur ira!! kods man arii ira ideja sekojosha: <code><font color="#000000"> <font color="#0000CC"><? </font><font color="#006600">if (</font><font color="#0000CC">$skaits </font><font color="#006600">> </font><font color="#0000CC">$lpp_limit</font><font color="#006600">) { </font><font color="#0000CC">$count</font><font color="#006600">=</font><font color="#0000CC">$skaits</font><font color="#006600">; </font><font color="#FF9900">//cik vispār komentu; </font><font color="#0000CC">$bum</font><font color="#006600">=</font><font color="#0000CC">$lpp_limit</font><font color="#006600">; </font><font color="#FF9900">//pa cik grupēt </font><font color="#006600">echo(</font><font color="#CC0000">"<p Align="</font><font color="#0000CC">Left</font><font color="#CC0000">">"</font><font color="#006600">); </font><font color="#0000CC">$n</font><font color="#006600">=(int)(</font><font color="#0000CC">$count</font><font color="#006600">/</font><font color="#0000CC">$bum</font><font color="#006600">); </font><font color="#FF9900">//cik būs "lapu" kljuda shite "ceil" neder </font><font color="#006600">if ((</font><font color="#0000CC">$count</font><font color="#006600">/</font><font color="#0000CC">$bum</font><font color="#006600">)<>((int)(</font><font color="#0000CC">$count</font><font color="#006600">/</font><font color="#0000CC">$bum</font><font color="#006600">))) </font><font color="#0000CC">$n</font><font color="#006600">++; </font><font color="#FF9900">//nodroshina lai nebuutu nekad // lieka tuksha lapa </font><font color="#006600">for (</font><font color="#0000CC">$x </font><font color="#006600">= </font><font color="#0000CC">1</font><font color="#006600">;</font><font color="#0000CC">$x </font><font color="#006600"><= </font><font color="#0000CC">$n</font><font color="#006600">; </font><font color="#0000CC">$x</font><font color="#006600">++) </font><font color="#FF9900">//shite kljuda $x nedriixt buut 0 </font><font color="#006600">{ if (</font><font color="#0000CC">$_GET</font><font color="#006600">[</font><font color="#0000CC">lpp</font><font color="#006600">] == </font><font color="#0000CC">$x</font><font color="#006600">) { </font><font color="#FF9900">// ja $lpp ir vienads ar to lappusi, kas jau ir paradita ekrana </font><font color="#006600">echo </font><font color="#CC0000">'['</font><font color="#006600">.(</font><font color="#0000CC">$x</font><font color="#006600">*</font><font color="#0000CC">$bum</font><font color="#006600">).</font><font color="#CC0000">'-'</font><font color="#006600">.((</font><font color="#0000CC">$x</font><font color="#006600">==</font><font color="#0000CC">$n</font><font color="#006600">)?(</font><font color="#0000CC">$count</font><font color="#006600">):((</font><font color="#0000CC">$x</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">)*</font><font color="#0000CC">$bum</font><font color="#006600">)).</font><font color="#CC0000">']'</font><font color="#006600">; </font><font color="#FF9900">// izvada vienkarsi lappuses numuru bez hiperlinka </font><font color="#006600">} else { echo </font><font color="#CC0000">"<a href=?id=gbook&action=view&lpp=$x>"</font><font color="#006600">; echo </font><font color="#CC0000">'['</font><font color="#006600">.(</font><font color="#0000CC">$x</font><font color="#006600">*</font><font color="#0000CC">$bum</font><font color="#006600">).</font><font color="#CC0000">'-'</font><font color="#006600">.((</font><font color="#0000CC">$x</font><font color="#006600">==</font><font color="#0000CC">$n</font><font color="#006600">)?(</font><font color="#0000CC">$count</font><font color="#006600">):((</font><font color="#0000CC">$x</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">)*</font><font color="#0000CC">$bum</font><font color="#006600">)).</font><font color="#CC0000">']'</font><font color="#006600">; </font><font color="#FF9900">//kljuuda shite ??? </font><font color="#006600">echo </font><font color="#CC0000">"</a>"</font><font color="#006600">; </font><font color="#FF9900">//citadak izvada lpp num ar a href </font><font color="#006600">} } </font><font color="#0000CC">?> </font> </font> </code> Link to comment Share on other sites More sharing options...
laacz Posted May 19, 2003 Report Share Posted May 19, 2003 <code><font color="#000000"> <font color="#0000CC"><? </font><font color="#006600">for (</font><font color="#0000CC">$x </font><font color="#006600">= </font><font color="#0000CC">0</font><font color="#006600">;</font><font color="#0000CC">$x </font><font color="#006600">< </font><font color="#0000CC">$n</font><font color="#006600">; </font><font color="#0000CC">$x</font><font color="#006600">++) { if (</font><font color="#0000CC">$_GET</font><font color="#006600">[</font><font color="#0000CC">lpp</font><font color="#006600">] == </font><font color="#0000CC">$x</font><font color="#006600">) { </font><font color="#FF9900">// ja $lpp ir vienads ar to lappusi, kas jau ir paradita ekrana </font><font color="#006600">echo </font><font color="#CC0000">'['</font><font color="#006600">.(</font><font color="#0000CC">$x</font><font color="#006600">*</font><font color="#0000CC">$bum</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">).</font><font color="#CC0000">'-'</font><font color="#006600">.((</font><font color="#0000CC">$x</font><font color="#006600">==</font><font color="#0000CC">$n</font><font color="#006600">)?(</font><font color="#0000CC">$count</font><font color="#006600">):((</font><font color="#0000CC">$x</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">)*</font><font color="#0000CC">$bum</font><font color="#006600">)).</font><font color="#CC0000">']'</font><font color="#006600">; } else { echo </font><font color="#CC0000">"<a href=?id=gbook&action=view&lpp=$x>"</font><font color="#006600">; echo </font><font color="#CC0000">'['</font><font color="#006600">.(</font><font color="#0000CC">$x</font><font color="#006600">*</font><font color="#0000CC">$bum</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">).</font><font color="#CC0000">'-'</font><font color="#006600">.((</font><font color="#0000CC">$x</font><font color="#006600">==</font><font color="#0000CC">$n</font><font color="#006600">)?(</font><font color="#0000CC">$count</font><font color="#006600">):((</font><font color="#0000CC">$x</font><font color="#006600">+</font><font color="#0000CC">1</font><font color="#006600">)*</font><font color="#0000CC">$bum</font><font color="#006600">)).</font><font color="#CC0000">']'</font><font color="#006600">; </font><font color="#FF9900">//kljuuda shite ??? </font><font color="#006600">echo </font><font color="#CC0000">"</a>"</font><font color="#006600">; </font><font color="#FF9900">//citadak izvada lpp num ar a href </font><font color="#006600">} } </font><font color="#0000CC">?></font> </font> </code> Link to comment Share on other sites More sharing options...
Recommended Posts