Loops and Classes


Posted on 16th Feb 2014 07:03 pm by admin

I am making a template system and everything seems to be going well up until I have to loop in a variable where things starts to go weird. I need ideas on how to solve this.

It is not picking up variables where it changes within the loop.

Did you know?Explore Trending and Topic pages for more stories like this.
Ie...

Code: for ($i=0;$i<3; $i++) {
$body->loop_blocks('test_area', array(
"TEST" => $i,
"TEST2" => $test2)
);
}
It picks up TEST2 variable as it remains constant, but TEST variable remains at 0.

Code: function loop_blocks($blockname, $array = array()) {

$this->$_blockdata[$blockname . "."] = $array;

foreach ($this->$_blockdata[$blockname . "."] as $tags => $data) {
$this->_looparray[$blockname . "."] = ereg_replace("{" . $tags . "}", $data, $this->_looparray[$blockname . "."]);
}

return true;
}
$this->_looparray[$blockname . "."] is where a particular block of HTML Code needs to be repeated for a loop.

Any thoughts?
No comments posted yet

Your Answer:

Login to answer
331 Like 13 Dislike
Previous forums Next forums
Other forums

Find only certain URLs from page ... regex (semi-complete script)
Hi guys,

What I need to do is take a page & extract all the URLs from the page &a

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

natcasesort works on one server but not on another
Hi

I have a problem that I was hoping that someone can help me with.

I'm trying to use

How would I convert this into code using an if statement?
ES equals exam score m equals $mean s equals $total. I already coded my mean and total so I'm not g

form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...

h

Inserting multiple records from single form
I've found a number of threads that deal with this issue, but I'm new to php and coding language so

Inserting a check in checkbox from array value
Hello all,
I have a bit of code that works for a select option box, but does not work for my chec

Else statement screws up all css
Does anyone know what goes wrong in the process with this php code?
This code seems to be causing

Customizing message/behavior
Hi,I'm using the ASP.NET membership/authorization controls in my application. Some parts of my appli

Unexpected T_Variable ?
Hi all,
I dont really know what I am doing!! I know I'm doing something wrong, and I know its on

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash