Jump to content

individual divs with php


swamp

Recommended Posts

Hi there... I've got this script that splits up content into chunks of 900 characters into individually numbered divs...

 

$string = $post;
$i=1;
for($t=0; $t<strlen($string);$t++){
if($t%900==0) $i++;
$out[$i].=$string{$t};
}
?>

<?
foreach($out as $k=>$v) $out[$k]='<div id="content_'.$k.'">'.$v.'</div>';
$out=implode('',$out);

echo $out

 

 

I'm also using some java to show and hide divs so can browse through 'pages' of content without actually changin file.

 

How would i go a about adding in these buttons (previous + next page) into the script:

 

<p><span class="arrow-back"><a href="#" onclick="setVisible('content_0');">previous page</a></span>

 

<span class="arrow"><a href="#" onclick="setVisible('content_1');">next page</a></span></p>

 

Any help really appreciated - Thanks!

Link to comment
https://forums.phpfreaks.com/topic/120536-individual-divs-with-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.