For example let's take a custom made/edited offline.php:

  1. Is it ok (I know it's possible, duh) to write HTML directly into offline.php? Or...
  2. .. do I make changes in the core files that are called within said .php file?

Right now, my offline.php is mostly PHP code and the backend little window in Custom Message under Site Settings is filled with HTML code but I'd really prefer to have just HTML in the .php file. I have a few concirnes:

  • are there any security or other issues when doing this? IMO there shouldn't be since this is exactly how it's laid in HTML. Then again, HTML and PHP are worlds apart.
  • although it's possible, we don't write CSS into .html files anymore because we have .css for that. So, HTML for content and CSS for styling... Is that the same reason why I shouldn't write HTML in .php files like offline.php, error.php and so on and on?

Thanks for the feedback.


Ok, here's an example. This is the part in offline.php that calls the message and styling that I've inserted at the backend (Custom Message in File Settings):

<jdoc:include type="message" />
<?php if ($app->get('display_offline_message', 1) == 1 && str_replace(' ', '', $app->get('offline_message')) != '') : ?>
    <p><?php echo $app->get('offline_message'); ?></p>
<?php endif; ?>

If it's perfectly ok to just delete those lines and paste HTML code instead, then I'd prefer to use this option even though it's not just the message itself, it's also 20 lines of HTML.

And while we're at it, let's take another example: main index.php. Is it ok then to delete, let's say, the line <html lang="<?php echo $this->language; ?>" > and simply substitute it with <html lang="en" /> (since the website is only in one language)?

2 Answers 2


If your offline.php consists simply of a message in a very simple design, then just use HTML code inside it, do not even include core files, and do not include any PHP code.

There are no security concerns in either of the methods that you have listed, but my logic is that there is no point in having the processor do any calculation if you don't need it.

Offline pages typically have a few CSS styles, so you can just copy them directly into the offline.php page (in the <style... tags), instead of just including the CSS. There is no reason for adding another hit to the website for a simple offline page.

  • Exactly, I'm trying to keep it as minimal as possible and I wholeheartly agree with your logic there. If deleting PHP lines in exchange for HTML is ok, then you've just made my day. PS - I've expanded my original question. Thanks.
    – derpoholic
    Jul 15, 2016 at 17:36
  • You don't need that "message" code that you have. You also can switch the <html lang... to the static one (without the PHP code).
    – itoctopus
    Jul 15, 2016 at 19:11

Pure and only html is for creating mark up for static content pages, php is a scripting language that will output data dynamically after processing.

Taking off the php from the page, you are removing the dynamic part and Joomla will be voided at this point.
It's your choice how you want your pages work what to display. At the end when we are talking for webpages, the end result will be html to be rendered on the browser.

For security there is nothing involved by having only html.

We are still writing css inside html occasionally, it's not that it can't be used. There is also the option to add styles in the head part of the page and the 3rd option to load css from external files.

The 3rd option is recommended way because of the advantages it offers.

I wouldn't compare it with mixing html with php. PHP is written for being used with html. After that there are so many practices and patterns about writing clean code and separating logic from display etc... all these are long topics.

*the said php files is confusing me - not sure what you are talking about.

** You shouldn't do changes directly on core files that you don't control, as those changes will be removed with a future update.

  • Thanks for the input, I've expanded my question a bit. "The said .php file" is meant to be offline.php since i took it as an example. Perhaps I wasn't clear enough.
    – derpoholic
    Jul 15, 2016 at 17:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.