Jump to content

Check custom field option for current listing


JAN44

Recommended Posts

Hello,

What is the php code i should use to verify the choosed option for a specific custom field in current listing (on front end) ?

For example for the custom field jr_cars i need to check if the current listing have BWM as option or not, i am looking for True/false result.

I am using "advanced module extension" to show specific module on specific pages accross the website.

__

i am doing this with easydiscuss, here an example of the used code :

		require_once(JPATH_ADMINISTRATOR . '/components/com_easydiscuss/includes/easydiscuss.php');
		$postId = JRequest::getInt('id');
		$component = JRequest::getVar('option');
		$customView = JRequest::getVar('view');

		// set your respected category id here
		$respectedCatId = '23';

		if ($component == 'com_easydiscuss' && $customView == 'post' && $postId) {
			$post = ED::post($postId);
			$currentPostCategoryId = $post->category_id;

			if ($respectedCatId == $currentPostCategoryId) {
				return true;
			}
		}

		return false;

 

Link to comment
  • 2 weeks later...
×
×
  • Create New...