Difference between revisions of "How to add a suffix for click2search results page"

From JReviews Documentation
Jump to: navigation, search
 
Line 1: Line 1:
 
You will need to modify this file:
 
You will need to modify this file:
*<span style="color: blue">\com_jreviews\jreviews\controllers\categories_controller.php</span>
 
  
 +
'''Joomla'''
 +
<source lang="text ">
 +
/components/com_jreviews/jreviews/controllers/categories_controller.php
 +
</source>
 +
 +
'''WordPress'''
 +
<source lang="text ">
 +
/wp-content/plugins/jreviews/jreviews/controllers/categories_controller.php
 +
</source>
 +
 +
To prevent your changes from getting overwritten during an upgrade, you can place the file in overrides.
 +
 +
'''Joomla'''
 +
<source lang="text ">
 +
/templates/jreviews_overrides/controllers/categories_controller.php
 +
</source>
 +
 +
'''WordPress'''
 +
<source lang="text ">
 +
/jreviews_overrides/controllers/categories_controller.php
 +
</source>
  
 
Find function listings() and at the end of the function, right before this line:
 
Find function listings() and at the end of the function, right before this line:

Latest revision as of 11:47, 3 August 2016

You will need to modify this file:

Joomla

/components/com_jreviews/jreviews/controllers/categories_controller.php

WordPress

/wp-content/plugins/jreviews/jreviews/controllers/categories_controller.php

To prevent your changes from getting overwritten during an upgrade, you can place the file in overrides.

Joomla

/templates/jreviews_overrides/controllers/categories_controller.php

WordPress

/jreviews_overrides/controllers/categories_controller.php

Find function listings() and at the end of the function, right before this line:

return $this->render('listings','listings_' . $this->listview);

Add this code:

// click2search theme suffix customization
$click2SearchPage = isset($this->params['tag']);
if($click2SearchPage){
	switch(Sanitize::getString($this->params['tag'],'field'))
	{
		case 'fieldone':
			$this->viewSuffix = '_suffix1';
		break;
		case 'fieldtwo':
			$this->viewSuffix = '_suffix2';
		break;
	}
}


fieldone and fieldtwo are the names of the fields without the 'jr_' prefix. You need to choose the list type [blogview|tableview|thumbview] for the search results in the Configuration Settings, Search tab. But then it doesn't really matter which one you choose, you can put whatever you want in the suffixed file. So for instance, let's say you choose blogview. Your theme files would be:

  • listings_blogview_suffix1.thtml
  • listings_blogview_suffix2.thtml


If you use the Fields Module, you can enter the suffix for the results page in the module's parameters, setting Custom URL parameters.

Enter the suffix like this:

&tmpl_suffix=_suffix1