/    Sign up×
Community /Pin to ProfileBookmark

Looping an Array count.

So I’m trying to set up a function that will loop itself X times
per specified in my array and am having some troubles. I am
not a PHP Guru yet and am still figuring out the basics. A bit
of help would be greatly appreciated.

Let me post code, and I’ll run you through so you can see:

This array specifies my count, my file extension, and my name.

[code=php]
<?php $token = uniqid();
$noko = array(0 => ‘3’,1 => ‘ie6’,2 => ‘IEC Cable (16 AWG) YY-3/ST3’);
?>
[/code]

This is what the form data looks like

[code=html]
<?php $token = uniqid();
$noko = array(0 => ‘3’,1 => ‘ie6’,2 => ‘IEC Cable (16 AWG) YY-3/ST3′);
?><div class=”size”>
<form action=” name=”ID_<?=$token;?>”>
<p><img alt=” class=”pImg” name=”imgBig_<?=$token;?>” src=”<?=$src.$noko[1];?>-01-m.jpg” width=”170px” height=”170px” /></p>
<div class=”tImg sColor”><a href=”<?=$url.$noko[1].’.php’;?>”><?=$noko[2];?></a></div>
<div class=”ico”>
<img alt=” onMouseOver=”roll(‘<?=$src.$noko[1];?>-01-m.jpg’,'<?=$src.$noko[1];?>-01-m.jpg’,'<?=$token;?>’,’00’);” src=”<?=$src.$noko[1];?>-01-ico.jpg” />
<img alt=” onMouseOver=”roll(‘<?=$src.$noko[1];?>-02-m.jpg’,'<?=$src.$noko[1];?>-02-m.jpg’,'<?=$token;?>’,’01’);” src=”<?=$src.$noko[1];?>-02-ico.jpg” />
<img alt=” onMouseOver=”roll(‘<?=$src.$noko[1];?>-03-m.jpg’,'<?=$src.$noko[1];?>-03-m.jpg’,'<?=$token;?>’,’02’);” src=”<?=$src.$noko[1];?>-03-ico.jpg” />
</div>

<div class=”arrow”>
<img alt=” src=”http://omnisistem.com/images/1up.gif” name=”up_arrow_<?=$token;?>_00″ width=”20px” />
<img alt=” src=”http://omnisistem.com/images/pixel.gif” name=”up_arrow_<?=$token;?>_01″ width=”20px” />
<img alt=” src=”http://omnisistem.com/images/pixel.gif” name=”up_arrow_<?=$token;?>_02″ width=”20px” />
<input type=’hidden’ value=”3″ name=”icoLength<?=$token;?>”>
</div>
</form>
</div>
[/code]

I would like to look the contents of DIV Class [b]ico[/b] and
DIV Class [b]arrow[/b] to reflect the count of $noko[0], or
to have a function that will write the entire code chunk from
DIV Class [b]size[/b] to its close tag. It looks like I would
need two incrementing variables, on for the image extension,
and one for the JavaScript position. I would also need to
str_pad_left for leading zeros on counts => 10.

For future sight, $noko will eventually be replaced by either
SQL insert, or by XML Style sheets. This is a farther future
thing, but good to keep in mind incase my resolution will
have a major code overhall in the future!

Thanks Every/Any-one!

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @ehime spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...