Introduction to PHP for Drupal Tutorial #4: Conditional IF Statements

preview_player
Показать описание

In the fourth tutorial of this series, I walk you through PHP If statements which allow us to add some dynamic complexity to our PHP scripts. In doing so, we use an if statement to selectively print a message to a user but these can obviously get very complex. In short, an if statement is provided something to evaluate, which if true, executes some block of code. We conclude by looking at a statement which is a little more complex and reacts to input provided by a user via an HTML form.
Рекомендации по теме
Комментарии
Автор

You really are a natural teacher, Peter. Thank you for ALL the video tutorials. They really are helpful.

anne-mariemodery
Автор

This was excellent and just at the right level, thank you.  It teaches a lot more than a beginner course on php.

yeknafaskesh
Автор

Hey there, that's a good question, one I've come across on a few different occasions. You can't use tokens in your own code because they won't have been evaluated by the time your code runs. That said, if you are building a module, you will have access to all the information (and more) that actually build the tokens anyway -- i.e., you have access to the node, user, etc. depending on what Drupal hook you are using.

yaworsk
Автор

Thanks, man!
Your tutorials are great, helping sooo much!

joethumbsup
Автор

hi thank you so much for all your videos. its really helpful . can you please do a advenced theaming series thank you

afyounai
Автор

Hello! Is it possible to use IF with drupal tokens? I've tried and it doesn't work. If for example token value = 1.
$myvar1 = '[mytoken]';
if ($myvar == 1) {
print "be happy";
}
print "don't worry";

tixon
Автор

Thanks for the Video
can you do a theming tutorial for drupal 7

ittiunited
welcome to shbcf.ru