|
View previous topic :: View next topic |
| Author |
Message |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Tue Jun 19, 2007 4:54 am Post subject: Mod Wanted - "go to page" text box |
|
Does anyone know of a mod for the viewtopic and viewforum files to all me to add a "go to page" text field to the forums pages?
At present the page does all it's calculations about how many posts / pages there are, then generates the links in the pagination (1 2 3 ...200 next) - these links are to posts, not pages. When you go to page x, you are sending a link to post y.
I would like the reverse. To send it a page number like "page=20". It would then recognize that variable and then calculate which post number to start at, based on "no of posts per page * page".
If not then I'll try and crack it, but I'm sure this must have been done before.
Thanks
(I have looked for this without success on here, phpbb and nukecops and haven't found anything even though it seems a simple, useful mod. If it's somewhere obvious I apologise)
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
|
|
| Back to top |
|
 |
piraja Nice poster


Offline Joined: Apr 28, 2006 Posts: 63 Location: Finland
|
Posted: Tue Jun 19, 2007 6:15 pm Post subject: Re: Mod Wanted - "go to page" text box |
|
| hqarrse wrote: |
| If it's somewhere obvious I apologise) |
Me too!
Very interested about this kind of mod!
piraja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux / 2.0 / 5.0.67 / 5.2.6 / 9.2.1
|
|
| Back to top |
|
 |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Wed Jun 20, 2007 11:43 am Post subject: Re: Mod Wanted - "go to page" text box |
|
It's quite an easy programming tweak, but I'm pushed for time hence the 'has this been done before'. If no one comes to the rescue with the code I'll crack it tomorrow and post it on here.
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
|
|
| Back to top |
|
 |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Thu Jun 21, 2007 4:18 am Post subject: Re: Mod Wanted - "go to page" text box |
|
OK, here's the forum pages mod (much easier than I expected):
In viewforum.php
change this (about line 35)
| Code:: |
$start = (isset($_GET['start']) ? intval($_GET['start']) : 0);
|
to
| Code:: |
$start = 0;
if (isset($_GET['start']))
{
$start = intval($_GET['start']);
}
elseif (isset($_POST['startpage']))
{
$start = $board_config['topics_per_page']*(intval($_POST['startpage']) - 1);
}
|
Then in themes/THEME/forums/viewforum_body.html add the following where you want your 'go to page' bit:
| Code:: |
<form action="{U_VIEW_FORUM}" method="post" name="gotopageform">
(in here I have table / layout)
<input name="startpage" type="text" size="3" maxlength="4" />
<input type="submit" name="Submit" value="Go to Page" id="Submit" />
(also in here)
</form>
|
Topic pages to follow
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
Last edited by hqarrse on Thu Jun 21, 2007 4:47 am; edited 1 time in total |
|
| Back to top |
|
 |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Thu Jun 21, 2007 4:39 am Post subject: Re: Mod Wanted - "go to page" text box |
|
And the topics:
viewtopic.php at about line 50:
change
| Code:: |
$start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0;
|
to
| Code:: |
$start = 0;
if (isset($_POST['startpage']))
{
$start = $board_config['posts_per_page']*(intval($_POST['startpage']) - 1);
}
elseif (isset($_GET['start']))
{
$start = intval($_GET['start']);
}
|
then in viewtopic_body.html
| Code:: |
<form action="{U_VIEW_TOPIC}" method="post" name="gotopageform">
<input name="startpage" type="text" size="3" maxlength="4" length="3"/>
<input type="submit" name="Submit" value="Go to Page" id="Submit" />
</form>
|
Neither of those has been run live yet so there's no guarantee there won't be side effects. Obviously I'll post any that I find once I start using it.
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
|
|
| Back to top |
|
 |
aptd Heavy poster


Offline Joined: May 04, 2007 Posts: 186
|
Posted: Thu Jun 21, 2007 7:14 am Post subject: Re: Mod Wanted - "go to page" text box |
|
Looks good man, nice...
aptd's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux | Apache[1.3.37] (Unix) | MySQL[4.1.21] | PHP[4.4.5] | DF[9.1.2.1]
|
|
| Back to top |
|
 |
Eestlane I18N / L10N Lead Dev


Offline Joined: Apr 06, 2005 Posts: 1404 Location: Estonia
|
Posted: Thu Jun 21, 2007 8:34 am Post subject: Re: Mod Wanted - "go to page" text box |
|
Good work.
What happens if wrong page number is used or maybe even letter instead of number?
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1
|
|
| Back to top |
|
 |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Thu Jun 21, 2007 9:15 am Post subject: Re: Mod Wanted - "go to page" text box |
|
| Eestlane wrote: |
Good work.
What happens if wrong page number is used or maybe even letter instead of number? |
Wrong page numbers are OK - if they're too big you get empty threads or the most recent topics, but....
The character causes a database error page instead of just returning to the same page. I'll sort that out now.
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
|
|
| Back to top |
|
 |
piraja Nice poster


Offline Joined: Apr 28, 2006 Posts: 63 Location: Finland
|
Posted: Thu Jun 21, 2007 10:03 am Post subject: Re: Mod Wanted - "go to page" text box |
|
Good work, hqarrse! Very nice!
piraja's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux / 2.0 / 5.0.67 / 5.2.6 / 9.2.1
|
|
| Back to top |
|
 |
Eestlane I18N / L10N Lead Dev


Offline Joined: Apr 06, 2005 Posts: 1404 Location: Estonia
|
Posted: Thu Jun 21, 2007 10:24 am Post subject: Re: Mod Wanted - "go to page" text box |
|
If it's working well, I suggest adding it to core.
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1
|
|
| Back to top |
|
 |
piraja Nice poster


Offline Joined: Apr 28, 2006 Posts: 63 Location: Finland
|
|
| Back to top |
|
 |
Eestlane I18N / L10N Lead Dev


Offline Joined: Apr 06, 2005 Posts: 1404 Location: Estonia
|
Posted: Sun Jul 01, 2007 9:16 am Post subject: Re: Mod Wanted - "go to page" text box |
|
I think that the URL's where it goes to shouldn't work only with POST as if someone wants to bookmark that page or give a link for a friend (s)he can't do it if not using regular paging system.
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1
|
|
| Back to top |
|
 |
hqarrse Diamond Supporter


Offline Joined: Mar 20, 2005 Posts: 177
|
Posted: Tue Jul 03, 2007 5:50 am Post subject: Re: Mod Wanted - "go to page" text box |
|
I hadn't seen that, but it's not a big issue in my opinion so I'm not going to have a chance to tackle that one, sorry!
_________________ Olive Net
British Army
Royal Navy
Military Clothing and Equipment - This Tribe
hqarrse's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Slackware 12 / CentOS, PHP 5.6, MySQL 5, Apache 2
|
|
| Back to top |
|
 |
Eestlane I18N / L10N Lead Dev


Offline Joined: Apr 06, 2005 Posts: 1404 Location: Estonia
|
Posted: Tue Jul 03, 2007 10:15 am Post subject: Re: Mod Wanted - "go to page" text box |
|
Well, I could do it myself also, if I would use it, so no problem.
Eestlane's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/2.0.63/5.0.67/5.2.8/9.2.1
|
|
| Back to top |
|
 |
Phoenix • Many Posts •


Offline Joined: Apr 19, 2004 Posts: 8799 Location: Netizen
|
Posted: Tue Jul 03, 2007 10:24 am Post subject: Re: Mod Wanted - "go to page" text box |
|
The "page" you bookmark will become meaningless as time and posts progress.
I've lost count of the number of indexed "pages" I've found in a search where the result is useless as the topic/post is no longer there - in your own interest it is best not done.
_________________ • DonationsPro for DragonflyCMS, SMF, MyBB, vBulletin •
Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
|
|
| Back to top |
|
 |
|
|