3

I'm new to Joomla and currently creating a template for my website. Unfortunately I'm facing a problem which I did not found out how to solve.

I wanted a front page which is different from the rest of the website. On the web I read that I have to override the {template}/html/com_content/featured/default.php file for a different front page. Until here, this works fine.

The problem I encounter is that I want to have a page where all featured items are listed ordered by their publishing date (for example like most Blogs). I found out that I have to override the same file as for the front page ({template}/html/com_content/featured/default.php) but I want to design this page completely different than the front page.

Is there a possibility to create something like a "second overwrite" in the com_content/feature directory? E.g. creating a default_frontpage.php in this folder and apply this override only to the front page while using the default.php for the listing of the featured items?

What would be the best way to archive my goal? If possible, I want to avoid to copy the whole template with all its files (this seems error-prone to manage all dependencies to me) and instead create one file for the front page only.


Edit

As Michael answered, I added a new file called frontpage.php in the html/com_content/featured folder (and yet copied the content of the default.php) but unfortunately, I cannot choose this file as the template theme. Do I have to provide information somewhere that there is a second file beside the default template?

Directory Tree Available Template-Theme Options

2 Answers 2

1

You'll be surprised to know that the solution is way easier than you might have imagined.

You're not required to name it "default.php". You can name it anything you want. You could, for example, name it "homepage.php" (I'll continue using this name.)

When you've created your homepage.php in the /html/com_content/featured/ folder, the new option will appear within your menu item edit screen. The details tab has a setting for "Template Style". In this dropdown, you'll find your new homepage file listed as an option.

Right now, this only works with com_content. I've recently created a bug report in the Joomla GitHub for a few other components - but for now you can only rely on this working in com_content.

3
  • Hello Michael and thanks for the answer! I tried it but unfortunately there is no second template style I can choose when I edit the menu. Is there anything I missed or made wrong? I edited the question and provided two screenshots. I use the latest Joomla version.
    – Drudge
    Nov 14, 2018 at 17:28
  • That's interesting - it doesn't seem to be valid for the featured view.... I have a separate template called "extensions" for my Joomla extension pages...I use this feature all the time....but I've never tried to use it in the way you suggested...I just assumed it would work. I'll dig deeper and see if I can figure a solution, because yours is a cool question worth answering.
    – Michael
    Nov 17, 2018 at 2:50
  • Michael, this would be great. Thank you in advance!
    – Drudge
    Nov 19, 2018 at 17:55
1

There's always more than one way to do something. This is just a possibility that occurred to me, I haven't tested it extensively, but take a peek at it and see if it'll work for you.

Create an articles->category module, in the filtering options select "Featured Articles" -> "only" and override the default output of that to suit your need.

Then create a "normal" content item and include that module in it. Might work for you, depending on what you need from it.

Your Answer

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

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