t3od0r Posted October 23, 2006 Share Posted October 23, 2006 i have a problem with my jokesite and i couldnt find help nowhere elseat the bottom of the page there is << 1 2 3 >> number for other pagesbut the link on those numbers are "/jokes_category.php?from=y&" y is where the numbers of jokes on the page and follow on but it should be like "/jokes_category.php?from=y&cat_id=x" X is where the number of categoryfor example when i have 15 jokes in category number 2 and its showing ten on one page and 15 on other so the link for the next page shud be like this "/jokes_category.php?from=10&cat_id=2" BUT it makes the link like this "/jokes_category.php?from=10&" where "cat_id=2 is missing...The code is [url=http://www.uploading.com/files/F6H4OT7J/php.txt.html]here[/url] and the php code for this i think start's from the line 727.where could be the problem...thankx for any kind of helpsorry for my bad english ;D[code]// Next prevoius using numbers/****************************************************/function make_next_previous_with_number($from, $SQL, $filename, $vars, $display_nr){ $count = bx_db_num_rows(bx_db_query($SQL)); @$active = ($from+$display_nr) / $display_nr; @$total_pages = ceil($count/$display_nr); if ($active <= $display_nr) { if ($active>1) { echo "<a href='".$filename."?from=0&".$vars."'><img src=\"".DIR_IMAGES."first.gif\" border=\"0\"></a> <a href='".$filename."?from=".($active*$display_nr-2*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."previous.gif\" border=\"0\"></a> "; } for ( $i = 1 ; $i <($active + $display_nr) && $total_pages >=$i ; $i++ ) { if ($active == $i) { if ($count > $display_nr) echo "<b>".$i."</b> "; } else echo "<a href='".$filename."?from=".($i*$display_nr-$display_nr)."&".$vars."'>".$i."</a> "; } if ($count > $active && $count > $active*$display_nr) { echo " <a href='".$filename."?from=".($active*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."next.gif\" border=\"0\"></a>"; echo " <a href='".$filename."?from=".(ceil($count/$display_nr)*$display_nr-$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."last.gif\" border=\"0\"></a>"; } } else { if ($active>1) { echo "<a href='".$filename."?from=0&".$vars."'><img src=\"".DIR_IMAGES."first.gif\" border=\"0\"></a> <a href='".$filename."?from=".($active*$display_nr-2*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."previous.gif\" border=\"0\"></a> "; } for ( $i = $active - $display_nr ; $i < ($active + $display_nr) && $total_pages >= $i ; $i++ ) { if ($active == $i) echo "<b>".$i."</b> "; else echo "<a href='".$filename."?from=".($i*$display_nr-$display_nr)."&".$vars."'>".$i."</a> "; } if ($count > $active * $display_nr) { echo "<a href='".$filename."?from=".($active*$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."next.gif\" border=\"0\"></a>"; echo " <a href='".$filename."?from=".(ceil($count/$display_nr)*$display_nr-$display_nr)."&".$vars."'><img src=\"".DIR_IMAGES."last.gif\" border=\"0\"></a>"; } }}[/code] Quote Link to comment Share on other sites More sharing options...
Orio Posted October 23, 2006 Share Posted October 23, 2006 Can't you just post the relevant piece of code here...?Orio. Quote Link to comment Share on other sites More sharing options...
respiritu Posted October 24, 2006 Share Posted October 24, 2006 Hello, I had this script to display my news content on one area of my website. What it basically does it it displays all the news contents all at once. Could you please help me revise the script so I can only display two or five news content at a time. Below is the actual php script: <?php $data = file('data/news.db'); $data = array_reverse($data); foreach($data as $element) { $element = trim($element); $pieces = explode("|", $element); echo "<h1>" . $pieces[0] . "</h1>" . "<p>" . $pieces[2] . "</p>"; } ?>Here is the actual news content format it parses on the website which is basically saved on a .txt file: 03.20.06|Raphael|test news 03.25.06|Raphael|test news 03.29.06|Raphael|test news I am looking forward for any help you can offer. Thank you in advance. Quote Link to comment Share on other sites More sharing options...
t3od0r Posted October 24, 2006 Author Share Posted October 24, 2006 And you couldn't start a new topic for your problem?Somebody for my problem? Quote Link to comment Share on other sites More sharing options...
respiritu Posted November 2, 2006 Share Posted November 2, 2006 LOL! I pity you dude! You act like a kid who wants to have all the candies Quote Link to comment Share on other sites More sharing options...
btherl Posted November 3, 2006 Share Posted November 3, 2006 respiritu, please move your question to another topic. Being polite wouldn't hurt either.t3od0r, the lines looking like this generate the links:[code]echo "<a href='".$filename."?from=".($i*$display_nr-$display_nr)."&".$vars."'>".$i."</a> ";[/code]The function uses "$vars" to add any additional variables, such as the category id you want to be included. Somehow you will need to ensure that $vars, when given as an argument to make_next_previous_with_number(), is set to "cat_id=x".If that makes no sense at all, post again and I'll explain further :) Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 3, 2006 Share Posted November 3, 2006 [quote author=respiritu link=topic=112457.msg462070#msg462070 date=1162510753]LOL! I pity you dude! You act like a kid who wants to have all the candies[/quote]It's not a matter of being childish. It's a matter of sanity (that of everyone who tries to help) and politeness. It can be VERY confusing to have two seperate questions running in the same thread. If you had a question about some code that was posted as part of an answer to the original question, that wouldn't be too bad. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.