rocknbil - 4:05 pm on Jun 15, 2012 (gmt 0)
Though I don't really get it, I get some of it that might help. Enter the ternary operator - this is a one line equivalent of "if/else" - if condition is true, use the first value, otherwise use the value after the colon. So
in those cases, I would like to be able to have an 'echo' or some code that will look for the number, and if '$num' does not exist, then it would use '$image'.
// First set it to null OR if it exists somewhere
$num=([some condition])?[value from 'some condition']:null;
// then your other variables
$image = "some-image.jpg";
As for "some condition",
I have to match a list and add them one at a time.
Programmatically? Let's say you have an include* that "gets" this list and creates an array. In that case you could do this:
// remove the initialize to null mentioned above and just do this one line:
And one of the 2 images need to load when/after a PHP include adds a navigation menu.
It shouldn't be a problem, in fact, any variables in your include will become available to your current page. So in the above example, your include could be the common place where you define your "match list" array.