Jump to content

Help with Request Data with Ipdownloads


DSystem
 Share

Recommended Posts

I'm doing block on ipPages and I need it to be visalisado only in downloads of a certain category.

Block Script:

{{if \IPS\Request::i()->controller == 'view' && request.app == 'downloads' && request.module == 'downloads' && \IPS\Request::i()->category == 22}}
<BR> test
{{endif}}

does not work because \IPS\Request::i()->category does not return any value.

What would be the right \IPS\Request?

Link to comment
Share on other sites

37 minutes ago, DSystem said:

I'm doing block on ipPages and I need it to be visalisado only in downloads of a certain category.

Block Script:


{{if \IPS\Request::i()->controller == 'view' && request.app == 'downloads' && request.module == 'downloads' && \IPS\Request::i()->category == 22}}
<BR> test
{{endif}}

does not work because \IPS\Request::i()->category does not return any value.

What would be the right \IPS\Request?

I assume you copy & pasted this?
THere's no reason to use \IPS\Requestion::I() and request. at the same time! request is just a shortcut for \IPS\Request::I();

A reminder for the other shortcuts: 

  • member
  • settings
  • output
  • theme
  • cookie

 

	/**
	 * Expand shortcuts
	 *
	 * @param	string	$content		Content with shortcuts
	 * @return	string	Content with shortcuts expanded
	 */
	public static function expandShortcuts( $content )
	{
		/* Parse shortcuts */
		foreach ( array( 'request' => 'i', 'member' => 'loggedIn', 'settings' => 'i', 'output' => 'i' ) as $class => $function )
		{
			$content = preg_replace( '/(^|[^\$\\\])' . $class . "\.(\S+?)/", '$1\IPS\\' . mb_ucfirst( $class ) . '::' . $function . '()->$2', $content );
		}
		
		foreach( array( 'theme' => '\IPS\\Theme::i()->settings', 'cookie' => '\IPS\\Request::i()->cookie' ) as $shortcut => $array )
		{
			$content = preg_replace( '/(^|[^\$\\\])' . $shortcut .'\.(.([a-zA-Z0-9_]+))/', '$1'. $array . '[\'$2\']', $content );
		}
		
		return $content;
	}
	


I hope this helps to avoid some confusion.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...