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

create a plugin


Rekomendowane odpowiedzi

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.com

Odnośnik do komentarza
Udostępnij na innych stronach

  • 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'>

 

  • Dziękuję 1

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

You may also try it. One thing - please try different ways before ask. That how it work - you ARE the developer, has dev board for that, don't be affraid to test various things! :)

  • Lubię to 1

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

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.com

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager

Not sure. Did you added that setting key in the plugin dev settings tab? Show me your full XMLplugin content please to investigate.

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

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.com

Odnośnik do komentarza
Udostępnij na innych stronach

  • Manager
15 godzin temu, Arash Ranjbar napisał(a):
 \IPS\Settings::i()->datalocation_settings

Where is that setting key here?

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

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

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.com

Odnośnik do komentarza
Udostępnij na innych stronach

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

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • 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ę.