anyone know this? PAGANATION based on characters of a variable..

Started on the old forum in July 2011 · view the original in the archive · old links redirect here

3 replies · 432 views · started 15 years ago · 1 min read

4 participants
leadiztah Developer · 55 posts #1

i know the concept of paganation and im already working for this..

but i know is based on the ROW in the DATABASE..

I want PAGANATION that based on a no. of character of a variable or a ONE data from the database.

Lets say that if a character/variable is more than 100 chars. then it paginate. 😀

....

Coding-Talk a place where noobs become professionals

Added after 3 minutes:

who can give me a example of an explanation is a coding-talk professional 😀

arnage Lead · 811 posts #2

Same all. GET page, read var lenght, condition if counted var > 100 split it.

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
kei_ki7 Senior · 431 posts #3

If you want to cut a paragraph with 450 characters and give you 5 pages.

Then refer to the lavalair blog coding.

Did I help you? You can help me too Your donations will help me finance my studies.

GumSlone Administrator Principal · 1,690 posts #4

i think this should work, havent tested it.

<?
$page = $_REQUEST['page'];

$text = 'some looooooooooooong text';

$text_length = strlen($text);
$number_of_symbols_per_page = 100;

if($page>0)
{
	$start = $number_of_symbols_per_page*($page-1);
}
else
{
	$page = 1;
	$start = 0;
}

echo substr($text, $start, $number_of_symbols_per_page);

if($text_length>0)
{
	$number_of_pages = ceil($text_length/$number_of_symbols_per_page);
}
if($number_of_pages>0)
{
	echo 'Pages: ';
	for($i=1;$i<=$number_of_pages;$i++)
	{
		if($page==$i)echo '['.$i.']'; else echo '<a href="'.$_SERVER["PHP_SELF"].'?page='.$i.'">'.$i.'</a> ';
	}
}

?>

Added after 5 minutes:

leadiztah wrote: ....

Coding-Talk a place where noobs become professionals

Added after 3 minutes:

who can give me a example of an explanation is a coding-talk professional :D

if you continue posting texts like this nobody will help you.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close