Notice

This old forum is now only available for consultation/read. User accounts on this old website are blocked.Please create a new account on seblod.com and use the new forum http://www.seblod.com/community/forums.Apologies for this perturbation and thank you for your understanding!

I'm not sure if I understand... is it that you are trying to check for a value in all of the articles of the content type.... and if it exists, play the list and if it doesn't, show some text? For that, you would probably have to run the FOR loop twice (first check for the value, then to display).

Do you have a live page so we can take a look?

If not, can you at least give a background of what you're doing (it sounds like you're going through a user content type and checking for a birthday?? Sorry, I don't know German...)

No problem quickmick and greetings to Germany from Berkeley, CA! I once spent a couple weeks Cologne and a town north of Hamburg and have some good memories.

Ok, correct me if I'm wrong. I think you're saying that you want to list out everyone who's birthday is "today"? Meaning, if more than one person has a birthday, list all of them? If I'm right about that, or if I can figure out what you're really trying to do I can probably help.

Assuming I am getting it, the if statement inside the loop looks in the right place. But some of the code I'm not sure of.

Here's some code that should work for checking if today's date:

if(date('d-m') == substr($jSeblod->list[$i]->geburtstag->value,x,y))

d-m sounds right for the date format (for Europe), but make sure it matches what you used in the field.

X should be the point in the date string where the month-day (or day-month) begins, and y the amount of characters to read. Do you have the right numbers? 10 for y seems too big.

Aside from that, are you sure you want to have an else statement here? What you're saying is that EACH AND EVERY time it's NOT someone's b'day to echo "LEER". (I wish I knew what leer means!) If you don't want to do that, you should take out this else.

Maybe you just want to echo "Leer" if no birthdays at all are found??? I can probably tell you how to do that if you can help my simple mind understand

Yeah, I guess I'm like most Americans. We always assume everyone else know our abbreviations (and everything about us)... Can see parts of SF out my window!

Do you have the right numbers? 10 for y seems too big.

This is for calculate the Years. Example: Congratulations for your 81. Birthday
The input date is: 21.03.1990 (dd.mm.yyyy) - (char 6 to 10)

When you're checking for the birthday, you should exclude years. That is part of the problem because someone's bday year will never occur again! So check for just day/month and no year in the IF statement. You can still say congratulations you're 81 but calculate the age separately. If your date is being stored as dd.mm.yyyy, your IF should look something like:

Funny I was joking around, but I did it again... yes SF is San Francisco. Yeah, today was one of those rare awesome sunny days for the bay and I could see both the city and the golden gate very clear Hope the weather is good in Germany.

Basically without having access to the site, I am not good enough with PHP to simply look at it and say it will work or not. That's also why I am trying to help in pieces. But at a glace, there is some redundant code but what you did looks ok. Let me know...

Because I put the date check and geburtstag field directly into the if statement, you only need what $a4, $a5 and $a6 are doing (if in the end you code it like I did). But $a4 is wrong I think. So to get the person's age, I think you could combine them all into: