Hot answers tagged

13

You should call JHtml::_('jquery.framework'); before your other JHtml::script. AFAIK this makes sure that jQuery is loaded first.


7

You should maintain the uncompressed version for development. Use any tool to compress the javascript files automatically. if Joomla debug mode is true, include un-compressed files, else include compressed files. Tip Checking debug mode in joomla. echo JDEBUG ? 'debug mode is on' : 'debug mode is off' ;


6

I finally found what seems to be the "correct" way to do this. Even if I used sendHeaders, the additional Content-Type was being added and that got returned as it was added later. I followed through the code and AbstractWebApplication.php sets the headers with this line: // Send the content-type header. $this->setHeader('Content-Type', $this->...


6

You are probably running into conflict problems, since both jQuery and the mootools library use the '$' char as shortcut. There are multiple ways to deal with that problem. You have to find out which method works best for you. Not all of these may apply to your template. A) Replace all '$' characters with 'jQuery' as $ is a shortcut for jQuery B) Add ...


5

to include specific JS and CSS in a component, I follow Michael Babker's advice: Use the media Folder, Allow Overridable Media http://www.babdev.com/blog/139-use-the-media-folder-allow-overridable-media at your root component folder, create a folder called media inside, create 2 folders, css and js Don't forget to include the required blank index.html in ...


5

First the reason re sizing fixes it is that the map checks that everything is "correct" on browser resize. Since the tab is hidden by default the size of the map is smaller until the tab is opened, but no event is getting sent to the map to notify of the change. I have seen similar problems with google maps before and its not really a problem, just something ...


5

This is the only workaround I've found so far (opened for review): // MooTools window.addEvent('domready',function() { Element.prototype.hide = function() { alert('Intercepted'); // Do nothing }; });


5

This is a very old question and probably nobody reads it anymore, but anyways I will post my answer. In the regex for the JQuery caption you have errors. You don't need to escape dots but you have to escape special characters. And also you need to target the correct key in the array so you need to add ['text/javascript'] after calling the script object. So ...


4

Google Charts is plain simple, and you don't add Kbytes to your download. I've implemented Google Charts to fill chart requirements. jqPlot library (and similar libraries) provides a better feature set, and you can also customize advanced features, but you have to manage the full installation (version, size, etc).


4

jQuery automatically gets imported in noConflict mode when you use the following code: JHtml::_('bootstrap.framework'); which also as you can probably figure out, loads the Bootstrap framework too. You will see on line 38 of the index.php file in the Prosostar template folder


4

You will need to create a custom form field for this. So firstly, change the type of the field in your XML like so: <field name="brands" type="brands" label="Foreign Brands" /> Then in your XML, replace your <fieldset> with: <fieldset addfieldpath="/modules/mod_mymodule/fields"> Then, create a new PHP file called brands.php in: ...


4

Your code has several errors, here's a couple: js.js You can't load scripts using <script> inside a .js file You shouldn't need to load jQuery at all, it's included in Joomla (and it's usually loaded by your template or other extensions). If not, use JHtml::_('jquery.framework'); to load it properly. This entire file looks unnecessary to me, as you'...


4

Well in case you don't want to use Joomla Ajax Interface, you could also do it like this: You have a module and you have your component. The script code goes into a javascript file or the view of the module (so that it will be invoked by the module). Then you build your Component. Your component only needs to be installable, it does not need any ...


4

Try this: $this->_scripts = array(); unset($this->_script['text/javascript']);


4

You need to trigger submit on form for login user. edit: did not see You don't have a login id in your div. so try this: jQuery('.loginbtn').trigger('click'); and if this not work for you try this: jQuery('.loginbtn').parents('form').submit();


4

Javascript have global variables : http://www.w3schools.com/js/js_scope.asp inside you php file you call: JFactory::getDocument(); and you can now add some javascript at the current page with addScriptDeclaration() In this example, we declare a myJoomlaVersion variable <$php $jdocument = JFactory::getDocument(); $jversion = new JVersion(); $...


4

After this question was originally answered, Joomla introduced in version 3.5 another way of passing variables to javascript, using the addScriptOptions() method of the Joomla Document class. So I'm just adding this to make other people who are interested in this question aware of this alternative. In your php file you can write eg: $phpvars = array('...


3

To load the session you need to get it from JFactory. $session = JFactory::getSession(); Read more on How to access session variables set by an external script.


3

Took a little digging but I see the issue https://github.com/joomla-framework/application/blob/master/src/AbstractWebApplication.php If you look at the setHeader function it does not actually set the header yet, it only gets it "ready" So what you need to do is simple $this->app->setHeader('Content-Type', 'application/json', true)->sendHeaders();...


3

If I remember it right, JCE uses an iframe for the content. Thus, you need to get a reference to the iframe first, then access the inner document of the iframe, which will provide the innerHTML as the text you are looking for. I did this once, but unfortunately I can't acces the code until Sunday. I would start with something like this (this is how I ...


3

You need to add &format=raw at the end of the URL so it will look like the following: index.php?option=com_component&task=checkDomain&tmpl=component&format=raw Hope this helps


3

I've never used RokSprocket before but I hope this answer will help you. Lets say you have the following HTML markup for your button: <div class="loadmore">Load more</div> Now rather than actually hiding the element, you make it transparent instead using CSS: .loadmore { opacity: 0; } And as for the auto load, you can trigger a click ...


3

Just use an attribute selector. You can target the href attribute in css with [href="#tabs_1a"] for example. I have no experience with jQuery, but the example in GDPs answer uses attribute selectors to add ids, so I'd guess jQuery supports this. The bottom line is that you do not really need to add anything, just use attribute selectors to target something ...


3

I think the best option here is to use Joomla Ajax Interface A slim, extensible component to act as an entry point for HTTP requests for stand alone modules and plugins, thus allowing for the potential of Ajax functionality in them. Com_ajax is generally used when you are not the developer of the component that the module or plugin is interacting ...


3

If you are using "Chosen" for your selects then you should trigger "Chosen" to update the data: jQuery("#jform_state").append("<option value=Bavaria>Bavaria</option>"); jQuery("#jform_state").trigger("liszt:updated"); The most recent version of "Chosen" uses a slightly different event: trigger("chosen:updated"); But in Joomla 3 (at the moment ...


3

I had the exact same thing a couple of days ago when testing some avatars in our extension. The message you've provided is being produced by Community Builder as it's importing jQuery Migrate (uncompressed). You can either, download the minified version and replace it, or open the current file and replace: jQuery.migrateMute = false with jQuery....


3

If you are using Nooku Framework to build your component you can make use of the build in template engine and special ktml tags which makes it very easy to add assets to your page head. First of all, you need to ensure that your component assets are in the Joomla /media folder. Example : /media/com_foo/css/bar.css Now you can use <ktml:style src="media:/...


3

It is generally a component that overrides the template files as you discovered. I personally build my sites of Zurb Foundation 5 - so I'm always removing bootstrap. So I would look at: Overriding the component and the code it generates - however this is usually a core file that will be overwritten when you upgrade the component Custom plugin - see ...


3

I am not sure about $input->get('data', '', 'array'). Are you sure that data var is being passed? I think you can simply use $input->getString('username') and so on to retrieve parts of the passed data query.


3

If you want to use the $ - sign inside your jQuery function, you have to call it like this: jQuery(function($) { $.contextMenu({ ... (Note the $ inside of function()) $ is just a shortcut often used for jQuery. In Joomla we have the problem that it often conflicts with other JavaScript libraries, like Mootools for example. You could also call it like ...


Only top voted, non community-wiki answers of a minimum length are eligible