Filter to default closed

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Filter to default closed

Post by mhonmon23 »

Hi,

Is there any config that will unexpanded / closed by default the filter?


Thanks
Attachments
filter.png
filter.png (8.19 KiB) Viewed 13479 times
istvanb
Posts: 226
Joined: 22 Aug 2010, 21:00

Re: Filter to default closed

Post by istvanb »

it just hides/shows the filtering options
Attachments
hideshowfilters.gif
hideshowfilters.gif (14.73 KiB) Viewed 13477 times
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

No, thats not what I want. What I need is default hide the filter / search functionality
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

I found this $g_dhtml_filters = OFF; but no luck its not working.
I placed $g_dhtml_filters = OFF; under config_inc.php

Any help?


-----------------------------
after reading more.. found this
Controls the use of DHTML filters that will display the filter in view page using DHTML and javascript. Default is OFF. This requires $g_use_javascript to ne set to ON. This may not work in all browsers as it requires xmlhttprequest functionality.
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter to default closed

Post by atrol »

So you want that the filter is always hidden when opening this page?
IMO no good idea. If a user decides to open the section he wants to get it until he decides to hide the section.
Please use Search before posting and read the Manual
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

Yes. I want it always hidden. is there possible way to keep it hidden until user decide to unhide it, but when user back to view page it should be hidden again.

Thanks
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter to default closed

Post by atrol »

AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.
Please use Search before posting and read the Manual
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

I see thanks atrol
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

atrol wrote:AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.

I will tell this to my boss! hahha thanks atrol
atrol
Site Admin
Posts: 8375
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Filter to default closed

Post by atrol »

Your boss will tell you:

If you decide to open the filter you want to see the filter until you decide to hide it or your boss decides to hide it.
Please use Search before posting and read the Manual
mhonmon23
Posts: 76
Joined: 22 Sep 2010, 10:43

Re: Filter to default closed

Post by mhonmon23 »

just for reference.

To make this default hide,
edit collapse_api.php

On collapse_open
if($p_name == 'profile'){ //change this string to what you want to hide as default
echo '<div id="', $t_div_id, '"', 'class="hidden"' , '>';
} else {
echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

And on collapse_closed
if($p_name == 'profile'){
echo '<div id="', $t_div_id, '"', ' class' , '>';
} else {
echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}
HiFi
Posts: 1
Joined: 08 Feb 2011, 16:58

Re: Filter to default closed

Post by HiFi »

atrol wrote:AFAIK there is no customization option for this, so you would have to change the source code.
TBH I would not like to work with such a system. If I decide to open the filter I want to see the filter until I decide to hide it.
Actually good point. Probably can be considered a "feature not bug" issue :)
clark99
Posts: 9
Joined: 13 Sep 2013, 08:12

Re: Filter to default closed

Post by clark99 »

HI All,

Any good solution for this?
I still cannot make it collapse in default esp for anonymous login
using ver 1.2.15

the code provided by mhonmon23 above seems like different with the current version as below.
Highly appreciate if anybody could let me know where to edit

Code: Select all

**
 * Marks the beginning of a collapse block's open phase.
 * This will be visible if the block is expanded, or if
 * javascript is disabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_open( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = collapse_display( $t_block );

	# make sure no other collapse section is started
	if( $g_current_collapse_section !== null ) {
		trigger_error( ERROR_GENERIC, ERROR );
	}

	$g_open_collapse_section = true;
	$g_current_collapse_section = $t_block;

	$t_div_id = $t_block . '_open';
	echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

/**
 * Marks the end of a collapse block's open phase and the beginning
 * of the block's closed phase.  Thi will only be visible if the
 * block have been collapsed and javascript is enabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_closed( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = !collapse_display( $t_block );

	# Make sure a section is opened, and it is the same section.
	if( $t_block !== $g_current_collapse_section ) {
		trigger_error( ERROR_GENERIC, ERROR );
	}

	echo '</div>';

	$g_open_collapse_section = false;

	ob_start();

	$t_div_id = $t_block . '_closed';
	echo '<div id="', $t_div_id, '"', ( $t_display ? '' : ' class="hidden"' ), '>';
}

/**
 * Marks the location where a +/- icon is placed in output
 * for the user to toggle the collapse block status.
 * This should appear in both the open and closed phase of a block.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_icon( $p_name, $p_section = '' ) {
	if( OFF == config_get( 'use_javascript' ) ) {
		return;
	}

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );

	global $g_open_collapse_section;

	if( $g_open_collapse_section === true ) {
		$t_icon = 'minus.png';
		$t_alt = '-';
	} else {
		$t_icon = 'plus.png';
		$t_alt = '+';
	}

	echo "<a href=\"\" onclick=\"ToggleDiv( '$t_block' ); return false;\"
			><img border=\"0\" src=\"images/$t_icon\" alt=\"$t_alt\" /></a>&#160;";
}

/**
 * Marks the end of a collaps block's closed phase.
 * Closed phase output is discarded if javascript is disabled.
 * @param string Collapse block name
 * @param string Collapse block section
 */
function collapse_end( $p_name, $p_section = '' ) {
	global $g_current_collapse_section, $g_open_collapse_section;

	$t_block = ( is_blank( $p_section ) ? $p_name : $p_section . '_' . $p_name );
	$t_display = collapse_display( $t_block );

	# Make sure a section is opened, and it is the same section.
	if( $t_block !== $g_current_collapse_section ) {
		ob_end_clean();
		trigger_error( ERROR_GENERIC, ERROR );
	}

	echo '</div>';

	$g_open_collapse_section = false;

	if( ON == config_get( 'use_javascript' ) ) {
		ob_end_flush();
	} else {
		ob_end_clean();
	}

	$g_current_collapse_section = null;
}

/**
 * Determine if a block should be displayed open by default.
 * @param string Collapse block
 * @return bool
 */
function collapse_display( $p_block ) {
	global $g_collapse_cache_token;

	if( !isset( $g_collapse_cache_token[$p_block] ) || OFF == config_get( 'use_javascript' ) ) {
		return true;
	}

	return( true == $g_collapse_cache_token[$p_block] );
}

clark99
Posts: 9
Joined: 13 Sep 2013, 08:12

Re: Filter to default closed

Post by clark99 »

Post Reply