GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Simple question to php gurus about pagination (https://gfy.com/showthread.php?t=1221697)

Andreweb 10-14-2016 10:39 AM

Simple question to php gurus about pagination
 
My php skills are very limited (I'm still learning) ! So there's a chance to paginate this thing ?

Code:

<?php
$xml = simplexml_load_file("camsx.xml");
foreach($xml->children() as $child){
    $gal[$child->getname()] = $child[0];
   
    foreach($child as $ch){
        $gal[$ch->getname()] = $ch[0];
   
    }
    if($gal['sex']=="Female" && $n < 1000 && $gal['showmode'] == "free"){
    ?><div id="grid">        <div class="host_box">
    <a href="/<? echo $gal['screenname']; ?>" target="_self" "><img src="<? echo $gal['liveimage']; ?>" alt="<? echo $gal['screenname']; ?>"><br>
    <? echo $gal['screenname']; ?></a>
    </div>
    <?php
    $n++;
    }
}
?></div>

It's just a way I found to parse cams from a XML feed and works just fine but I want to paginate that if is possible any help will be appreciated ! Thanks in advance !

porn-update 10-14-2016 11:55 AM

I'm not sure I understood what you want to do, but some time ago I did something similar to a paging putting a counter inside the foreach

Code:

<?php
$xml = simplexml_load_file("camsx.xml");
foreach($xml->children() as $child){
    $gal[$child->getname()] = $child[0];
   
    foreach($child as $ch){
        $gal[$ch->getname()] = $ch[0];
   
    }
    if($gal['sex']=="Female" && $n < 1000 && $gal['showmode'] == "free"){
/////////////////////
$start = $_GET['start'];
$stop = $_GET['start']+5;
if($n > $start && $n < $stop){
///////////////////////////////
    ?><div id="grid">        <div class="host_box">
    <a href="/<? echo $gal['screenname']; ?>" target="_self" "><img src="<? echo $gal['liveimage']; ?>" alt="<? echo $gal['screenname']; ?>"><br>
    <? echo $gal['screenname']; ?></a>
    </div>
    <?php
////////////////////
}
////////////////
    $n++;   
}
}
?></div>

$start in my case is passed in GET.
Load anyway the whole xml, but shows only a few lines of output

Andreweb 10-15-2016 12:16 AM

Thanks for your help ! That may work on my site with some changes !

celandina 10-16-2016 09:41 AM

Change this //////////////////////// to this ////////////////// and
This >>>>><<<<< to this >>>>>>>>>>>/>>>>><<<<

And do not forget... This :;:;:;:;:;: should read like this ;(::(;:;:;:;:;:

and it will work :1orglaugh


All times are GMT -7. The time now is 07:23 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc