The goal:
We have two CP search modules. We need to have results printed with "Title + HTML intro" when we search with the first module and with "Title only" when we use the second one.
How to:
1) We need to create an alternative template for CP output.
To do so, we copy the default template files with different names.
Template files files are contained into directory: components\com_customproperties\views\show\tmpl
default.php becomes alt.php (or another suitable name, you should avoid the word 'default' thou)
default.xml becomes alt.xml
We'll use the default template for "Title + HTML Intro" and the alternative one for "Title only".
2) Modify the xml manifest file alt.xml from:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Custom Properties Layout" >
<message>
<![CDATA[Returns content tagged with a specific CPtag]]>
</message>
</layout>
<name>Custom Properties</name>
<description>Returns content tagged with a specific CPtag</description>
to:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Custom Properties Alt Layout" >
<message>
<![CDATA[Returns content tagged with a specific CPtag, with an alternative layout]]>
</message>
</layout>
<name>Custom Properties Alt Layout</name>
<description>Returns content tagged with a specific CPtag, with an alternative layout</description>
This step is not mandatory, but it helps identifying the templates.
3) modify alt.php
We only need to force the 'title only' output, which is a very easy modification to do. Look for this code:
switch($view){
case 'title' :
echo showTitle( $row, $params );
break;
and force the 'title' view
$view = 'title'; // <=== add this
switch($view){
case 'title' :
echo showTitle( $row, $params );
break;
4) configure cp search modules
Leave the first module untouched, so that it keeps using the default template.
Set the 'template' parameter of the second module to 'Alt'.
5) the template is available as a menu item type too.