Line break for radio buttons in joomla 2.5 plugin

149 προβολές
Παράβλεψη και μετάβαση στο πρώτο μη αναγνωσμένο μήνυμα

leadersh...@gmail.com

μη αναγνωσμένη,
6 Ιουλ 2013, 9:53:45 π.μ.6/7/13
ως joomla-de...@googlegroups.com
Hi,

I have developed a plugin in Joomla 2.5 and Joomla 3.1, I have Provided some radio buttons for choosing certain parameter.

Below is the snippet of XML file :


<field name="button_style" type="radio" default="style_1" label="Button Style" description="">

<option value="style_1"><![CDATA[<img src="http://URL/facebook.gif" style="vertical-align:middle"/> <br/><br/>
]]></option>

<option value="style_2"><![CDATA[ <img src="https://URL/gtc-like-tweet-pinit.gif"/><br/><br/>]]></option>

On back-endpage of this plugin observed that ; the radio buttons appearing on same line in Joomla 2.5, but for Joomla 3.1 it's ok

Franz

μη αναγνωσμένη,
8 Ιουλ 2013, 8:28:48 π.μ.8/7/13
ως joomla-de...@googlegroups.com
A possible fix for 2.5 is to wrap the options in a <fieldset class="radio">...</fieldset> element.

leadersh...@gmail.com

μη αναγνωσμένη,
10 Ιουλ 2013, 10:22:15 μ.μ.10/7/13
ως joomla-de...@googlegroups.com
Thank you for your answer, it's really kind to take the time to write an answer, but unfortunately it didn't work for both Joomla 2.5 and Joomla 3.0 here is the updated code according to your advice


            <field name="button_style" type="radio" default="style_1" label="Button Style" description="">
           
                <fieldset class="radio">
                    <option value="style_1"><![CDATA[<img src="http://cache.addthiscdn.com/icons/v1/thumbs/menu.gif" style="vertical-align:middle"/><br/><br/>
                    ]]></option>
                  </fieldset>
               
                <fieldset class="radio">
                    <option value="style_2"><![CDATA[ <img src="https://cache.addthiscdn.com/www/20130225205628/images/gtc-like-tweet-pinit.gif"/><br/><br/>]]></option>
                </fieldset>

Franz

μη αναγνωσμένη,
11 Ιουλ 2013, 8:03:12 π.μ.11/7/13
ως joomla-de...@googlegroups.com
Sorry, I posted an approximate solution. The full code uses JVersion to print out that <fieldset> ONLY for Joomla 2.5. Here it is:

        if (version_compare(JVERSION, '3.0.0', 'lt')) // Only less than J3, i.e. J2.5 and previous
        {
            return '<fieldset class="radio">' . implode('<br style="clear: left"/>', $options) . '</fieldset>';
        }
        else
        {
            return implode("<br />", $options);
        }

This is production code, so it should work fine :-)

leadersh...@gmail.com

μη αναγνωσμένη,
11 Ιουλ 2013, 8:35:30 π.μ.11/7/13
ως joomla-de...@googlegroups.com
Thank you one more time, but you know the code of the back-end  of the plugin is written inside the xml file so I think that I can't use php there, correct me if I'm wrong :)

Franz

μη αναγνωσμένη,
12 Ιουλ 2013, 8:29:25 π.μ.12/7/13
ως joomla-de...@googlegroups.com
Sorry, I finally realized that I completely mis-read your original post. Of course you cannot add PHP in the XML file. I was thinking of a custom field type. but you are talking about the standard "radio" type. Please ignore my previous posts.
Απάντηση σε όλους
Απάντηση στον συντάκτη
Προώθηση
0 νέα μηνύματα