View Single Post
Old 05-03-2016, 04:43 AM  
k33n
Confirmed User
 
Join Date: Feb 2009
Posts: 201
Did anyone notice that there are no males and shemales cams in bonga xml??I just checked and only females and couples are included.Anyway,back to CB api.

I tried to get cams by category,so i defined categories

Code:
if( $cam->age <= "21" ) {
	
  $age= "teen";

} elseif ($cam->age > "21" && $age <= "30" ){

  $age= "women";

} elseif ($cam->age > "30" && $age <= "40" ) {

  $age = "milf";

} elseif ($cam->age > "40" ) {

  $age = "mature";

} else {

 $age = "";
}
From what i can understand,existing functions,print cams by gender,so i copied get_related function,modified name and changed every $gender with $age.My new function :

Code:
function cams_by_category( $affid, $track, $age, $limit ){

if( $cam->age <= "21" ) {
	
  $age= "teen";

} elseif ($cam->age > "21" && $age <= "30" ){

  $age= "women";

} elseif ($cam->age > "30" && $age <= "40" ) {

  $age = "milf";

} elseif ($cam->age > "40" ) {

  $age = "mature";

} else {

 $age = "";
}

				if ( $_GET['arg1'] ) {

					if ( is_numeric( $_GET['arg1'] ) ) {

						$page = $_GET['arg1'];

						$targetpage = 'live/';

					} else {

						$targetpage = 'live/' . $_GET['arg1'] . '/';

						if ( $_GET['arg2']  ) {

							if ( is_numeric( $_GET['arg2'] ) ) {

								$page = $_GET['arg2'];

							} 

						} else {

							$page = 1;
						}
					} 

				} else {

					$targetpage = 'live/';

					$page = 1;

				}

				$end 	= $page * $limit;

				$start	= $end - $limit;

				$xml = '../cache/cams.xml';

				$cams = new SimpleXMLElement($xml, null, true);

				// Count the total cams

				if ( $age != '' ) {

					$doc = new DOMDocument();

					$doc->load($xml);

					$totalCams = 0;

					foreach( $doc->getElementsByTagName('age') as $tag ) 

					{

						// to iterate the children

						foreach( $tag->childNodes as $child ) 

						{

							// outputs the xml of the child nodes. Of course, there are any number of

							// things that you could do instead!

							$i = $doc->saveXML($child);

							

							if ($i == $age )

								$totalCams++;

						}

					}

				} else {

					$totalCams = count($cams);

				}

				echo '
						<div class="row">

							<div class="12u">

								<ul class="cb_thumbs">

				';

				$count = 0;

				foreach( $cams as $cam ){ 

					if ( $cam->age == $age ) {

						if ( $count >= $start && $count < $end ) {

							print_cams($cam);							
						}

						$count++;

					} 

					if ( $age == '' ) {

						if ( $count >= $start && $count < $end ) {

								print_cams($cam);

						}

						$count++;

					}				

				}

				echo '
								</ul>

							</div>

						</div>
				';
		
			}
Call function in template file :
Code:
function tpl_category_cams() {

  $age = $_GET['arg1'];

		cams_by_category( AFFID, TRACK, $age, 60 );
Added in new page in index.php :

Code:
	$core->addCommand('live', 'tpl_category_cams', 'title','', 'Keywords');
Result: ALL CAMS,All ages At least i get something
k33n is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote