0

AddThis Toolbox を実装したい

<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style">
  <attribute ca:name="addthis:url">http://www.foobar.org </attribute>
  <attribute ca:name="addthis:title">An excellent website</attribute>      
  <a class="addthis_button_facebook"></a>
  <a class="addthis_button_twitter"></a>
  <a class="addthis_button_email"></a>
</div>

このようなものに、これが私のコードです。ホームページのタイトルのみをTwitterボックスに取得します。一般的には機能しますが、属性は統合されていません!

Div oDivAddThis = new Div();
oDivAddThis.setClass("addthis_toolbox addthis_default_style addthis_style");
oDivAddThis.setAttribute("ca:name='addthis:url'", "https://www.test.org");
oDivAddThis.setAttribute("ca:name='addthis:title'",oSearchDAO.getTitle()+" \n "+oSearchDAO.getDescription1()+" \n "+oSearchDAO.getDescription2());
oDivAddThis.setAttribute("addthis:url", "https://test.org.com/?cp="+oSearchDAO.getImage().trim());
oDivAddThis.setAttribute("addthis:title",oSearchDAO.getTitle()+" \n "+oSearchDAO.getDescription1()+" \n "+oSearchDAO.getDescription2());

A compGooglePlus = new A();
compGooglePlus.setClass("addthis_button_google_plusone_share");
compGooglePlus.setAttribute("addthis:url", "https://test.org.com/?cp="+oSearchDAO.getImage().trim());
compGooglePlus.setAttribute("addthis:title",oSearchDAO.getTitle()+" \n "+oSearchDAO.getDescription1()+" \n "+oSearchDAO.getDescription2());

A compFacebook = new A();
compFacebook.setClass("addthis_button_facebook");

A compTwitter = new A();
compTwitter.setClass("addthis_button_twitter");
compTwitter.setAttribute("addthis:url", "https://test.org.com/?cp="+oSearchDAO.getImage().trim());
compTwitter.setAttribute("addthis:title",oSearchDAO.getTitle()+" \n "+oSearchDAO.getDescription1()+" \n "+oSearchDAO.getDescription2());

A compCompact = new A();
compCompact.setClass("addthis_button_compact");
compGooglePlus.setParent(oDivAddThis);
compFacebook.setParent(oDivAddThis);
compTwitter.setParent(oDivAddThis);
compCompact.setParent(oDivAddThis);

私もこのようなことを試しました(クライアント/属性名前空間)

oDivAddThis.setAttribute("ca:name='addthis:url'", "https://test.org/?cp="+oSearchDAO.getImage().trim());
oDivAddThis.setAttribute("ca:name='addthis:title'",oSearchDAO.getTitle()+" \n "+oSearchDAO.getDescription1()+" \n "+oSearchDAO.getDescription2());

どんな助けでも大歓迎です、ありがとう

更新 [解決済み]

Tony ( http://zkfiddle.orgの作者) の助けを借りて、私はそれを動かしました。私の間違いは、サーバー側で明確に評価される setAttibute を使用したことです。

私がしなければならなかったのは、クライアント側で評価される setWidgetAttibute を使用することだけでした。:-) すばらしい。アイデアを投稿してくれた victor に感謝します。また、私を大いに助けてくれた Tony に特に感謝します。

4

1 に答える 1

1

このコンポーネントには属性が設定されていないということですか? もしそうなら、zulページでタグを試してみてください。これでうまくいくかもしれません...

更新: これは、URL 画像を配置するときに行うことです。画像の名前をオブジェクトに保存し、次の方法でアクセスします: (@Listen onCreate イベントを使用)

<treecell>
<!-- STATUS -->
<image src="/Librerias/Imagenes/${each.data.status}.png">
<custom-attributes attributeName="value" />
</image>
</treecell>
于 2013-06-13T16:53:09.763 に答える