Skocz do zawartości
Hosting webh.pl - 20%

create a plugin

Rekomendowane odpowiedzi

Opublikowano

hi

I am developing a plugin but I have a small problem.

I want to insert below code snippet in the following tag!

my code:

data-adress="{{if member.language()->isrtl}}test1{{else}}test2{{endif}}"

my following tag:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow'>

result:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow' data-adress="{{if member.language()->isrtl}}test1{{else}}test2{{endif}}">

 

Which one should I choose?

Firefox_Screenshot_2022-09-22T13-05-13_864Z.png.70087049c75df7d580dfc306876db2ff.png

I try "Modify the chosen element(s) to add attribute(s)" but got an error!

ArashDev.net

Opublikowano
  • Manager

Last one - Replace and replace whole li code, not only one line:

<li class="ipsDataItem ipsDataItem_responsivePhoto" data-location='{$row->locationHash}' data-controller='forums.front.forum.topicRow'>

 

intermedia - profesjonalne rozwiązania Invision Power Board, IC5

Opublikowano
  • Autor

I finally do it. Thanks

Now I want to add a settings in the plugin, so when I want the first option to be enabled, the following Variable will start working inside the tag and it will stop working when I disable it.

<li data-address="location">

For this I tried below methods:

<!--mothod 1-->
<li {{if settings.datalocation_settings}}data-address="location"{{endif}}>
<!--method 2-->
<li {{if \IPS\Settings::i()->datalocation_settings == '1'}}data-address="location"{{endif}}>

With these methods, the plugin works, but the settings do not.

what's the problem?

ArashDev.net

Opublikowano
  • Autor
1 hour ago, DawPi said:

Did you added that setting key in the plugin dev settings tab?

yes

setting key:

 

Spoiler

Firefox_Screenshot_2022-09-23T16-22-40_174Z.thumb.png.4044e765b024066f23adcfd84b010882.png

 

setting.php:

//<?php

    $form->addTab( 'dataaos_setting' );
	$form->add( new \IPS\Helpers\Form\YesNo( 'dataaosforums_setting_ed', \IPS\Settings::i()->dataaosforums_setting_ed, FALSE, array(), NULL, NULL, NULL, 'dataaosforums_setting_ed' ) );
	$form->add( new \IPS\Helpers\Form\YesNo( 'dataaostopics_setting_ed', \IPS\Settings::i()->dataaostopics_setting_ed, FALSE, array(), NULL, NULL, NULL, 'dataaostopics_setting_ed' ) );

    $form->addTab( 'dataaos_about_plugin' );
    $form->addHeader( 'dataaos_about_text' );
    $form->addHeader( 'dataaos_support_links' );
	
if ( $values = $form->values() )
{
	$form->saveAsSettings();
	return TRUE;
}

return $form;

 

ArashDev.net

Opublikowano
  • Autor
4 minutes ago, DawPi said:

Where is that setting key here?

Sorry, there was a typo

<!--mothod 1-->
<li {{if settings.dataaosforums_setting_ed}}data-address="location"{{endif}}>
<!--method 2-->
<li {{if \IPS\Settings::i()->dataaosforums_setting_ed == '1'}}data-address="location"{{endif}}>

 

ArashDev.net

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Ostatnio przeglądający 0

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

Szukaj

Szukaj

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.