0
Hello I have the following problem:
When I press the button it generates 24 more images, this is not my wish, I want you to continue only 24 and just change for the following. (see here)
code:
<head>
<title>Hebbo Gadget</title>
</head>
<style>
.hebbo {height: auto;overflow:hidden;width:230px;}
.emblema {float: left;height:50px;width:50px;margin: 3px;border-radius: 15px;background-repeat: no-repeat;background-position: center center;}
</style>
<div class="hebbo" id='test'>
<?php
$url = "http://hebbohotel.com.br/swf/gamedata/hebbo_texts.txt?9761831";
$data = file_get_contents($url);
$newlines = array("\n" ,"\r", "\r\n", ">", "<", "/");
$content = str_replace($newlines, "", html_entity_decode($data));
$statusHtml = '/badge_desc_(.+?)=/';
preg_match_all($statusHtml, $content, $statusRaw);
$badges = implode("-", $statusRaw[0]);
$badgeVar = explode("=-badge_desc_", $badges);
$badgeVar2 = str_replace("=", "", $badgeVar);
$badgeVar3 = str_replace("badge_desc_", "", $badgeVar2);
$number = count($badgeVar3);
$i = 1;
$e = 24;
// aqui você entra com incremento de variável
$maisClique = ((isset($_GET['cliquei']) and !empty($_GET['cliquei']))?$_GET['cliquei']:false);
if(isset($maisClique) and !empty($maisClique)){
$e += $maisClique;
}
while ($i <= $e)
{
$number = $number - 1;
$imageUrl = "http://hebbohotel.com.br/swf/c_images/album1584/" . $badgeVar3[$number] . ".gif";
echo '<div class="emblema" style="background:url(' . $imageUrl . ') no-repeat center, #E7E7E7;"></div>'; // changed this echo to display the image.
$i++;
}
// aqui você define o valor $cliques que será calculado em $number para alterações da matriz
if(isset($_GET['cliquei']) and !empty($_GET['cliquei'])){
$cliques = $_GET['cliquei'] + 24;
}else{
$cliques = 24;
}
?>
<input type="button" onclick="window.location.replace('http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?cliquei=".$cliques ?>')" value="cliquei" />
</div>
Should make the value $i go back to 1 and replace the existing ones by restarting the iteration again.
– Pedro Franco
I’ve changed a few things that I understand is what you asked for. Check there and you can check my url: http://www.atualgeek.com/test In the link is the code made.
– Pedro Franco