June 10th, 2006 at 12:09 am

(I don’t know if there’s going to be a part II … )
But, Wordpress has an interesting way of dealing with “control structures” — that is, ifs, whiles, etc etc.

Although you can add “tags” to create and modify pages (and The Loop), at its heart, it MUST adhere to the rules of PHP — because that’s how Wordpress is built upon.

Therefore, its curious how it deals with its control structures, because THERE ARE NO CURLY BRACKETS!

That is, when you usually use an “IF”, the actual stuff which follws the operator is usually enclosed in curly brackets!

To wit:
if (anita == pregnant) {hungfamily +=1; }

ANYWAY:

There are no curly brackets in the actual code.

That is, there is nothing like:
(DIFFICULT TO EXPLAIN WITH EXAMPLES … )

Is anita pregnant? yes she is!

RATHER:
Wordpress uses an interesting quirk because its SYNTAX is also borrowed from PYTHON:
SEE: http://vsbabu.org/tutorials/php/index-2.html

In other words, it can also follow this syntax (that is, NO CURLY BRACKETS)

if (expr1) :
...
...
elseif (expr2) :
...
else :
...
endif;

Therefore, you can get away with just including things like without any curly braces … just make sure to end it properly!

One Response to “How Wordpress Integrates PHP Part I.”

  1. 123 Directory Submission :

    Try the WordPress PHP Validator at

    http://www.stilglog.com/wordpress-plugins/php-validator/

    It will solve many problems because of the different syntax.

Leave a Reply.

Please note the comments policy

Jun
10
2006
12:09 am