Search
Left Quote    If at first you don't succeed, redefine success.
- Anon.    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: lend words of advice?
  This user is offline  ki
  Subject: "lend words of advice?" Posted: @ 9:44 pm on Oct 27 2006   

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

Does anyone know how you would use pagination toward a forum listing with multi-page topics?


woohoo!
    Viewed: 20,318 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 10:38 pm on Oct 27 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

yea, pagination is all about the query. Totally check out the Pagination Tutorial we have, and Pagination Code Sample




-bs0d | AllSyntax.com

    Viewed: 20,310 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 2:22 am on Oct 28 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

I know those but yours also shows "1" even if theres not a full page and if you leave it blank it shows up as "" 2 3



Edited at 02:25:15 am on 10/28/06


woohoo!

    Viewed: 20,306 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 3:46 am on Oct 28 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

I use the same exact pagination code on these forums, the proxies, list of articles and code samples. If you're not getting a full page, that is probably because the LIMIT is set higher than the results you have. If you have 10 results and want 5 pages out of those 10 results, then the limit should be set to 2, and the pagination code will display 1 - 5.




-bs0d | AllSyntax.com

    Viewed: 20,301 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 6:13 pm on Oct 28 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

thanks, I also need to know how to use the view option, you think you can help me out with that?




woohoo!

    Viewed: 20,288 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 6:13 am on Oct 29 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

post specific details of your problem and we can go from there.




-bs0d | AllSyntax.com

    Viewed: 20,282 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 1:17 pm on Oct 29 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

The view count for every topic (Thread not needed)
I think I somewhat got it, dealing with the ip of the user?




woohoo!

    Viewed: 20,276 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 6:51 pm on Oct 29 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Depends on how you want to handle it. Unique views or just total views.

I went with just using total views and not dealing with users IP's to determine if they have already been counted. Less foot-work and still effective. I would recommend just maintaining total views.




-bs0d | AllSyntax.com

    Viewed: 20,273 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 3:44 am on Oct 30 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

yea total views, also im having trouble with viewing last post, everything works when i remove it but when Its added it shows 1 forum im like




woohoo!

    Viewed: 20,267 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 4:36 am on Oct 30 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

well, you record the time when posts are made, correct? Then for your query, select the post data and order by time desc




-bs0d | AllSyntax.com

    Viewed: 20,263 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 11:12 am on Oct 30 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

ok u lost me, is this for the views? or the viewing last post?




woohoo!

    Viewed: 20,248 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 12:48 pm on Oct 30 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Last post.

For views, on each page load of the thread i'd do an UPDATE query and say views = views + 1.




-bs0d | AllSyntax.com

    Viewed: 20,245 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 7:40 pm on Oct 30 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

I got all that down. Another thing I wanna know whats the cookie age for 30 days?




woohoo!

    Viewed: 20,238 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 7:48 pm on Oct 30 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

also how can u like, turn a certain number of characters from
hey its friday
to
hey its...
?




woohoo!

    Viewed: 20,236 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 12:49 am on Oct 31 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

On the cookie, check this out: PHP: setcookie()

On the 2nd part, im not sure what you mean... You can use str_replace() to replace text, like if $var = "Hey its friday" you could do:

$var = str_replace(&q uot;friday&quo t;, "...&quo t;, $var);




-bs0d | AllSyntax.com

    Viewed: 20,231 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 1:53 am on Oct 31 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

I know but im going to be doing this for forum topics like last post




woohoo!

    Viewed: 20,228 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: lend words of advice?" Posted: @ 3:23 am on Oct 31 2006    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Oh, like an ellipsis function? If a string is longer than XX characters, then display the ellipsis? I have a function I found I believe on PHP.NET, here it is:


Code:


function ellipsis($strin g, $length) {
return (strlen($string ) > $length) ? substr($string, 0, $length) . '...' : $string;
}


The variables pretty much explain how to use it. Just call the function, then input the variable of your string followed by a comma, then enter the length of the string you wish to display before replacing the rest with the ellipsis (...).




-bs0d | AllSyntax.com

    Viewed: 20,223 Times | Reply to This | To top
  This user is offline  ki
  Subject: "re: lend words of advice?" Posted: @ 4:38 am on Oct 31 2006    

Member #: 204
Rank: User - (50)
Since: 09/16/06
Posts: 53
From: Florida

Thats exactly what I needed!


by the way Ive noticed you use different BBCode styles for each result.
If your having a problem with say like [ url = "tragical .net " ] sas [ / url ]
(without spaces)

use this.


Code:


if (stripos($rep, '[url=') !== false) {
$rep = str_replace('[ url=&quot; ','<a href="', $rep);
$rep = str_replace('& amp;quot;]',' ">',$ rep);
$rep = str_replace('[ /url]','</ a>',$rep);< br /> }




$rep is the text of the message.
do the same for quote and it should work




woohoo!

    Viewed: 20,220 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank