Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
566 views
in Technique[技术] by (71.8m points)

php - Joomla custom Template Override not working

I want to use a template override for Articles in Joomla, therefore I am using

mytemplate/html/com_content/article/default.php

If I change anything in this file the changes do appear. But as I want to use an extra .php-file f.e.

mytemplate/html/com_content/article/alternativeLayout.php 

I am facing a problem. Because although I can select this layout on the article settings page - any Changes I make do not appear and still the default.php is used.

Any ideas what I am doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In order for an alternative layout to be used, two conditions must be met -

  1. You must select the layout in the article parameters
  2. No menu item can exist for this item - the layout selection of the menu item will override the selection in the article parameters

It sounds like your problem is with #2.

EDIT Duh, I missed the key part of using alternate layouts. In order to be able to use an alternate layout with a menu item, you have to create an alternatelayout.xml file and place it in the override folder. This will give you an additional menu item option that you select when creating your menu item. You should be able to copy the defailt.xml file and edit it for the new layout.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...