Jump to content

Proper parsing of HTML in a custom PHP block

Featured Replies

Posted

Hi IC Community,

I've recently made a PHP script to query my gameservers for their current status using the built-in blocks feature in IP.Pages.

However all the HTML I'm using is outputted using echo statements. Is it possible in any way to parse it like normal HTML code, instead of having multiple echo statements?

Edited by Dunkstormen

I'm not sure I'm clear on what you are after. Can you show us the code you're using (feel free to change any details for privacy, etc.) and what you are hoping to change it to as an example?

If you're using a raw PHP block, then yes generally you just echo/print the output. You can use the heredoc syntax if you want to piece components together.

echo <<<EOF
           {$variable1}<br><i>some html</i>{$variable2}
EOF;

 

Alternatively, depending on the code, it may be feasible to use a normal HTML pages block instead - they support template logic, which unless you have really complex multi-line php statements involved can do the same things.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.