| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Pages of files | |
|---|---|
| Tweet Topic Started: Jun 13 2005, 06:14 PM (571 Views) | |
| JCink | Jun 13 2005, 06:14 PM Post #1 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Hi I am stuck on something. I have this code:
basically all it really does is show the topics on this page here: http://jcinkcom.ho8.com/php/sources/admin/...Testing%20Board and it does this by just showing all of the files in a folder, ( this folder to be exact ) and arsorting them. What I was wondering is... is there a way, with the way I have things setup, to make a code to limit the number of files appearing per page? to about only showing 15 files per page? I honestly have no idea how I would do this... Thanks in advance... |
![]() |
|
| solinent | Jun 13 2005, 08:44 PM Post #2 |
|
Member
![]() ![]() ![]() ![]() ![]()
|
Well I am not that great at php, but one thing you have done with the .txt thing Just do $title = split(".txt", $whateverfilenamelol); $title = $title[0]; And for your real question....Can't you use a For loop instead of a while loop. You have alot of other things going on there, so I dunno wdh is happening :S like if ($_GET['page'] == 1) { for (i=0;i<15;i++) { //code for displaying topics on first page... } } else if($_GET['page'] == 2) { for (i=0;i<15;i++) { //code for displaying topics on second page... } } and just add like 50 pages lol.. There must be a more efficent way to do it though. I like how you made your own forums...I must try that someday :S |
![]() |
|
| kingy | Jun 14 2005, 04:32 AM Post #3 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You appear to have some errors in your php as well, does this parse? becasue by the looks of it your echos switch from text variables without using ". or ." |
![]() |
|
| JCink | Jun 14 2005, 11:36 AM Post #4 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
@solinent: thanks, that idea worked somewhat well. I couldn't make pages exactly though with that way, but I made a replacement. Now it just shows 15 topics, and theres a menu below the forums to show last 20, last 50, last 100, etc at least now though it is limited to something. As far as the other split(); thing, I had no idea it was that easy - someone else had taught me to do it the other way. Thanks. @kingy: yes that parses. |
![]() |
|
| kingy | Jun 14 2005, 11:53 AM Post #5 |
|
1 in 10 people understands binary, the other 1 doesn't
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
ok...i will remember that for my code, makes things neater |
![]() |
|
| JCink | Jun 14 2005, 05:44 PM Post #6 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I have always done: echo "this is a $var"; in my codes and it works every time. Not sure if this is the right thing to do though... |
![]() |
|
| Seth | Jun 14 2005, 07:09 PM Post #7 |
|
I has a pony
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Of course. Double-quote interpolation of variables is acceptable and useful. If you don't wish variables to be parsed, you use single quotes. |
![]() |
|
| solinent | Jun 15 2005, 01:46 PM Post #8 |
|
Member
![]() ![]() ![]() ![]() ![]()
|
I'm so happy I helped someone ![]() And I never knew that single quotes would work like that :S Seth, that helped me more than you think ![]() :w00t: |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Technology Chat · Next Topic » |
| Track Topic · E-mail Topic |
11:29 AM Jul 11
|



![]](../../../../0/1/0/p601690/pipright.png)





11:29 AM Jul 11