» Home » loop » Page 1
Foreach loop only works inside wordpress loop, but echoes 6 times. Can I use it outside the loop?
by sm625 in Web Design
<?php $terms = wp_get_post_terms($post->ID,'category');
foreach ($terms as $term) {
$termcomp = $term->taxonomy . '_' . $term->term_id; } ?>
<?php the_field('tagline' , $termcomp); ?>

How Can I use this code on wordpress without it echoing 6 times, because I have 6 posts inside that category..

PHP Nested Loop. How on the second loop print items according to the id of the first loop?
by krismolendyke in Programming Languages

I need to print a wine list from a database.
I need to print at first a categorie and after all the items that are inside. Thats the order. And i have multiple categorie. So at the end the result will be categorie1, many items, categorie2 many items...

This is the code that i write from now: I think that my problem is to print items according to the id of the alcool_categorie !

for loop and if loop is refusing to print a varriable outside the loop?
by Dittmar in Programming Languages

i am facing a problem that after i created the jQuery post, i was able to receive all the data but as a one peace, so when i began rephrasing them i succeed until the final part which was the inserting into the database, where inside the for loop and if loop i am getting the value but when i wanted to start inserting them into the database i am getting null values, below is the for loop and if

Is there any significant difference between nesting a while loop in a while loop and nesting an if-else loop in a while loop? (C++)
by DMasterX in Programming Languages

EDIT: I forgot to add the loop part of the second code.

Looking at the two code styles

while(pre_x is not done)
//do action pre_x
//do action x


if(pre_x is not done)

In a nested for loop, how can we return to the first loop from second loop?
by phokus in Programming Languages

I have 2 loops like the code below:

for(NSString *link in pageLinks){
for(NSString *pattern in disallowedPattern){
if (range.location != NSNotFound )
// if condition is yes go back to the first loop.

I want the program to return to the first loop if the condition is yes. I used continue, but

In Java, does calling a field accessor in a loop create a new reference on each iteration of the loop?
by Hungary in Java

Say I have a loop like

for (Foo aType : bar.getAList()) {
if (aType.getBaz().equals(baz)) {
return aType;

bar.getAList() is called on each iteration of the loop. Does the JVM/compiler keep track of the fact that this is the same object, or does it naively call the method and create a reference to the List each tim

Create mini loop in the head to use advanced excerpt - loop to use current post ID
by turret in Web Design

I am using advanced excerpt plugin because there is so much more flexibility with it's options.

Though if found a drawback with the plugin, I have to remove the standard excerpt function using remove_all_filters('the_excerpt'); other wise it conflicts with the advanced excerpt options.


I want to add the except to my head in a open graph m

Reset loop, or return to start of loop, in Ruby? (Finding a number's factors)
by ShayH in Programming Languages

I am trying to find the factors of a number N. I want to be able to iterate over my prime numbers array, and when a condition is met, go back to start of the iteration, rather than just continuing on.

arrFactors = []
N = 150
[2,3,5,7,11].each do |a|
if N % a == 0
N = N/a
break if N == 1
<return to star

How do I make a 'while' loop print the results of the loop's conditional into a single line(concatenated)?
by l1feh4ck3r in Programming Languages

So here is my code:

test = {
'a':1, 'b':2 , 'c':3 , 'd':4
x = raw_input("Type 'abcd' ")
y = len(x)
z = 1
while z < y+1:
a = x[z-1]
print test[a]
z = z + 1

The point is to make a basic encoder, obviously this code is just to establish a quasi-code that I can build off of. My issue is this:

AVQueuePlayer: Loop last item in a queue (and eliminate hiccup) or loop last seconds of a video
by Tridnewly in Operating Systems

I am using AVQueuePlayer to play videos in sequence (although I have hiccups between plays).
Now I'd like to:

1) Loop the last item in that sequence (not the full one).

2) In doing so, I'd also like to eliminate hiccups.

Below is my code to play the videos sequence. How could I achieve my 2 goals?

[super viewDidLoad];
NSString *second

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .