swamp Posted August 21, 2008 Share Posted August 21, 2008 Hi there, I've got this code splitting the $post into divs containing 900 characters each... <? $i=-1; for($t=0; $t<strlen($post);$t++){ if($t%904==0) $i++; $out[$i].=$post{$t}; } ?> <? foreach($out as $k=>$v) $out[$k]='<div id="content_'.$k.'">'.$v."</div>"; $out=implode('',$out); echo nl2br($out); ?> I'm using java to flick through the divs, showing only one at a time, like pages (without changing the whole file) <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> I need the arrows that setVisibile('content_NUMBER') to work out which div you're currently in and then give you next and back so in div 3 you could go back to div 2 or forward to div 4... Any help? Thx! Link to comment https://forums.phpfreaks.com/topic/120673-setvisibile-with-php/ Share on other sites More sharing options...
swamp Posted August 22, 2008 Author Share Posted August 22, 2008 bump - sorry, really need some help with this! Cheers Link to comment https://forums.phpfreaks.com/topic/120673-setvisibile-with-php/#findComment-622824 Share on other sites More sharing options...
gerkintrigg Posted August 22, 2008 Share Posted August 22, 2008 well you'll need to set a javascript variable up so the script knows which page you're on and then make that div invisible and make the next / previous one visible... Just add that to your function and it should work fine. Try putting the post in the javascript forum rather than the PHP one - might be why you've not got a reply until now. Link to comment https://forums.phpfreaks.com/topic/120673-setvisibile-with-php/#findComment-622863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.