1

I'm starting a new Joomla 3. x template and I'm finishing the front page index.php, now the problem is when I go to an article the same page is appears (the front-page) how can I create a custom page for articles like articles.php .

index.php : (lot of code that's why I'm using the link) https://pastebin.com/qSRpc66U

1 Answer 1

1

Replace hardcoded HTML content with Joomla code. For example, add this to the main content area to render the component and system messages:

<jdoc:include type="message" />
<jdoc:include type="component" />

Use this to render the head:

<head>
    <jdoc:include type="head" />
</head>

Do not include any other tags within the head. Add tags programmatically instead, e.g. see the code you have on how to include stylesheets:

JHtml::_('stylesheet', 'template.css', array('version' => 'auto', 'relative' => true));

Do the same for your other stylesheets.

Use $this->setHtml5(true); to set HTML5 mode.

Set metadata with $this->setMetadata(), e.g.:

$this->setMetaData('viewport', 'width=device-width, initial-scale=1.0');

Note, only set global metadata that you want to appear on all pages. Do not add content-specific meta tags such as title or meta description. These are generated dynamically by components.

3
  • Should I create a article.php or just in index.php ?
    – TheLordOne
    Commented Aug 27, 2018 at 14:29
  • Normally just index.php. If you want to change the way articles look, create template overrides. See documentation docs.joomla.org/… and docs.joomla.org/Understanding_Output_Overrides.
    – Sharky
    Commented Aug 27, 2018 at 15:38
  • do you have examples for a complete index.php? in my index.php I don't want to show any content
    – TheLordOne
    Commented Aug 27, 2018 at 15:47

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.