0

Hi Everyone...

I am trying to do some Object calls within a PHP script which is INLINE within HTML. However the "->" PHP syntax is effectively closing the <?php start tag. How do I escape this syntax within the PHP to ensure the browser doesn't perceive it as a tag end?

Example:

blah........

<body>
<?php
if($thisUser->is_logged_in()){
$output='Welcome'
}
print $output;
?>
</body>

blah.........

The ">" of the "->" in $thisUser->is_logged_in() object call, causes the <?php to close. So what it renders to screen is straight text:

is_logged_in()){$output='Welcome'}print $output;?>

What is the best solution?

1 - Can I escape the ">"
2 - Would it make any difference if I abstracted the PHP into an seperate file?
3 - Is there another method for calling Object functions?

Cheers,
Todd

Edited by happygeek: fixed formatting

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by moobaa
0

Just saved it as a PHP file instead of HTML. D'oH!!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.