Another WordPress / PHP Question

Status
Not open for further replies.

jerxs

New member
Jun 24, 2006
1,806
24
0
North East PA
Why if using something like this cant you add PHP, but only echo and include?

Code:
<?php if (is_page('5') ) {

echo '<?php dgrs_get_post_positive_ratings($post->ID); ?>';

}

?>

In other words why can you not call to another PHP function or place another PHP tag in a sample like above?

This will work for this specific plugin, but;;;;

Code:
<?php if (is_page('5') ) {

echo 'dgrs_get_post_positive_ratings($post->ID)';

}

?>

But there have been many situations where trying to place something like the above will absolutely not work.

If there is a beginning <?php tag and an ending ?> php tag inside the above why will it not work?

PHP Dummy, thanks again, Jer ..........
 


When you use single quotes you are basically echoing whatever the text is inbetween the quotes, no variable conversion.

For example,

$var = 1;
$string = 'fuckyeah';
echo 'This is $var for the $string';

Will output: This is $var for the $string

Whereas is you use double quotes ("") it will print:

This is 1 for the fuck yeah.

I don't see how example 1 works, the <?php ?> should be ignored.
 
Status
Not open for further replies.