Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

Co w tym widgecie jest złego?


inzonek

Rekomendowane odpowiedzi

Witam, utworzyłem plugin, który posiada w sobie widget, lecz po zainstalowaniu go na normalnej wersji (tak samo jest na wersji dev.) podczas wchodzenia do Zarządzania blokami wyskakuje błąd:

Couldn't get list of available blocks

Według mnie wszystko w tym jest dobrze.

<?xml version="1.0" encoding="UTF-8"?>
<plugin name="teest" version_long="10000" version_human="1.0.0" author="ADW" website="" update_check=""><hooks><hook type="S" class="\IPS\Theme\class_core_front_widgets" filename="teest"><![CDATA[//<?php

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	exit;
}

class hook35 extends _HOOK_CLASS_
{

/* !Hook Data - DO NOT REMOVE */
public static function hookData() {
 return array_merge_recursive( array (
  'members' => 
  array (
    0 => 
    array (
      'selector' => 'div.ipsWidget_inner > ul.ipsList_reset > li.ipsPhotoPanel.ipsPhotoPanel_tiny.cAnnouncement > div > span.ipsType_light.ipsType_small',
      'type' => 'add_before',
      'content' => 's',
    ),
  ),
), parent::hookData() );
}
/* End Hook Data */


}
]]></hook></hooks><widgets><widget key="teest" class="\IPS\Widget" restrict="sidebar,cms" default_area="" allow_reuse="" menu_style="menu" embeddable=""><![CDATA[<?php
/**
 * @brief		teest Widget
 * @author		<a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
 * @copyright	(c) 2001 - 2016 Invision Power Services, Inc.
 * @license		http://www.invisionpower.com/legal/standards/
 * @package		IPS Community Suite
 * @subpackage	p6cd2ead26b
 * @since		22 Jan 2017
 * @version		SVN_VERSION_NUMBER
 */

namespace IPS\plugins\<{LOCATION}>\widgets;

/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
	header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
	exit;
}

/**
 * teest Widget
 */
class _teest extends \IPS\Widget
{
	/**
	 * @brief	Widget Key
	 */
	public $key = 'teest';
	
	/**
	 * @brief	App
	 */
	public $app = '';
		
	/**
	 * @brief	Plugin
	 */
	public $plugin = '<{ID}>';
	
	/**
	 * Initialise this widget
	 *
	 * @return void
	 */ 
	public function init()
	{
		// Use this to perform any set up and to assign a template that is not in the following format:
		// $this->template( array( \IPS\Theme::i()->getTemplate( 'widgets', $this->app, 'front' ), $this->key ) );
		// If you are creating a plugin, uncomment this line:
		// $this->template( array( \IPS\Theme::i()->getTemplate( 'plugins', 'core', 'global' ), $this->key ) );
		// And then create your template at located at plugins/<your plugin>/dev/html/teest.phtml
	
		parent::init();
		$this->template( array( \IPS\Theme::i()->getTemplate( 'widgets', $this->app, 'front' ), $this->key ) );
	}
	
	/**
	 * Specify widget configuration
	 *
	 * @param	null|\IPS\Helpers\Form	$form	Form object
	 * @return	null|\IPS\Helpers\Form
	 */
	public function configuration( &$form=null )
	{
 		if ( $form === null )
		{
	 		$form = new \IPS\Helpers\Form;
 		}

 		// $$form->add( new \IPS\Helpers\Form\XXXX( .... ) );
 		// return $form;
 	} 
 	
 	 /**
 	 * Ran before saving widget configuration
 	 *
 	 * @param	array	$values	Values from form
 	 * @return	array
 	 */
 	public function preConfig( $values )
 	{
 		return $values;
 	}

	/**
	 * Render a widget
	 *
	 * @return	string
	 */
	public function render()
	{
		return $this->output()
		// Use $this->output( $foo, $bar ); to return a string generated by the template set in init() or manually added via $widget->template( $callback );
		// Note you MUST route output through $this->output() rather than calling \IPS\Theme::i()->getTemplate() because of the way widgets are cached
	}
}]]></widget></widgets><htmlFiles/><cssFiles/><jsFiles/><resourcesFiles/><lang/><versions/></plugin>

 

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Wg mnie błąd jest tutaj:

$this->template( array( \IPS\Theme::i()->getTemplate( 'widgets', $this->app, 'front' ), $this->key ) );

Błąd, a raczej brak $this->app, zostaw 'core'.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager
13 godzin temu, inzonek napisał:

Można zamknąć.

Mam prośbę, byś kolejny raz jednak napisał co było nie tak. Dzięki.

intermedia - profesjonalne rozwiązania Invision Power Board

---

Chcesz uzyskać szybko i sprawnie pomoc? Uzupełnij wersję i adres w profilu.

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.