Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-14-2016, 10:39 AM   #1
Andreweb
Confirmed User
 
Andreweb's Avatar
 
Industry Role:
Join Date: Mar 2013
Location: Internet
Posts: 2,422
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 !
__________________
Make Money With: Chaturbate
Andreweb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-14-2016, 11:55 AM   #2
porn-update
Confirmed User
 
porn-update's Avatar
 
Industry Role:
Join Date: Apr 2014
Posts: 380
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
porn-update is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-15-2016, 12:16 AM   #3
Andreweb
Confirmed User
 
Andreweb's Avatar
 
Industry Role:
Join Date: Mar 2013
Location: Internet
Posts: 2,422
Thanks for your help ! That may work on my site with some changes !
__________________
Make Money With: Chaturbate
Andreweb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-16-2016, 09:41 AM   #4
celandina
Too lazy to set a custom title
 
Industry Role:
Join Date: Jun 2006
Posts: 10,896
Change this //////////////////////// to this ////////////////// and
This >>>>><<<<< to this >>>>>>>>>>>/>>>>><<<<

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

and it will work
celandina is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
paginate, php, xml, feed, found, alt=, free, parse, cams, fine, appreciated, advance, if$gal[sex]==female, limited, learning, skills, gurus, question, pagination, chance, $gal[$ch-getname], $ch, $ch[0];, simple, foreach$child



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.