How can I put Component into Module in Joomla! site? - joomla

I wonder if exists a way to put component into module without install plugin, neither component nor module.
Thanks and my apologize for my bad English.

First, should unable Editor from configuration site, in Panel Admin. Then, go to Extension -> Plugins -> TinyMCE and delete forbidden items "script".
Now, go to "create module", with custom HTML5 and put something like this:
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<div id="new-projects">
</div>
<script type="text/javascript">
$( "#new-projects" ).load( "urlOfYourComponent #idYouWouldShow" );
</script>
Thanks to Ilias cause the idea.

The only way to achieve this without installing any extensions is via a custom HTML joomla module where you'll place your component in an iframe.
Then if you want to load only the component part of the fetched page in the iframe use jquery's load function.

If i'm correct, You don't wanna install any kind of extension that do that, you ask for vanilla possibility to put component into module, so this is the answer, there is no way to put whole component into module. Partial Example: You can put article into custom HTML module or list categories into modules, but you will never see whole component into module. Why? Because component its a core thing on site, like people in building (or even the whole building) eg. house, and module is like painting on the wall, You can't put building on the painting.

Related

Modify Profile Avatar url in DNN

I run DNN 9.2.2. I have wrestled with this with two Themes, the default Xcillion and the easily available "dnnContra". I am logged on as host, hence the userId of 1 below.
Clicking the Profile Avatar displayed in the top-bar takes you to
http://exanoke.com/Activity-Feed/My-Profile/userId/1
We wish to modify the URL to
http://example.com/Activity-Feed/My-Profile/ctl/Profile/userId/1/pageno/2
I cannot detect where the URL is generated. I can't find any place to configure the URL. Since it has a userId that depends on the user who is logged on, I presume it depends on JavaScript. Both themes utilize bootstrap, probably bootstrap 4, so it may be in there.
Might anyone have experience with this?
To do this the best way, you would want to duplicate the user skin object and modify it, that's pretty involved though.
To do it quickly, hackish, you could add the following javascript anywhere to your page.
<script>
$( document ).ready(function() {
dnn_dnnUser_avatar.href += "/pageno/2"
});
</script>
You could add that directly to the skin itself, or you could add it into the MODULE settings (header or footer) of any module on the page. If you want it on EVERY page of your site, I recommend you put it into the skin.

Adding rating feature to Jetpack Carousel

I'm using jet-pack carousel in my gallery website and i want to add image rating capabilities. I have the "wp-postratings" plugin running on the rest of my site.
I'm assuming that i could add this to individual images as wp treats each image as a post, if so where would i find the template i should add this code to?
All the plugin requires is that i add one line of php to the page/image but i can't figure out where it shoud go as the code for carousel seems to be entirely js and php generated.
demo: http://so.devilmaycode.it/adding-rating-feature-to-jetpack-carousel/gallery/
in a js file jetPack_meet_wpPostRating.js copy this code (place the file in the js folder of your theme):
https://gist.github.com/aSeptik/9739808
in the functions.php file of your theme put this code:
https://gist.github.com/aSeptik/9739808
NOTE
after installing the above scripts make sure to delete the browser cache before test.
tested with latest wordpress, jetpack and wp-postrating versions.
this will also work with multiple gallery in the same page.
does not need to put any extra [ratings] shortcode anyware.
the bounty for this answer is too low... ;)
FIX
Fixed bugs added some check and debug to consol.log...
You can use hook into the Jetpack Carousel on the server-side
(like to output your data, for example).
Then on the client-side, get your Javascript rating code to
load after the Jetpack+Carousel JS, and hook into them
(hook on the bindings, etc).
JetPack provides 2 JavaScript hooks:
1) jp_carousel.afterOpen
2)jp_carousel.beforeClose.
Action hook code example

Joomla module or component to be render on a blank page

I have developed a Joomla module that does provides a form, processes its post data, does some calculations and displays the results.
The module includes a button to print the results. I'm currently using JavaScript to open a new window, paste the relevant HTML and open the print dialog.
Instead of JavaScript I would prefer to provide a separate URL for the print view and simply open that in a _blank target. This would make the application work better for people using screen readers or not having JavaScript available.
Is there any way that I can tell Joomla to not render the template along with my module? I was thinking that creating a component fixes that issue, but had to find that components are rendered into the template, too...
BTW: I have Joomla 1.5.22
To achieve what you want you have to add additional tmpl=component query string parameter to the request URL. This will disable template and module rendering.
Your URL will look something like this: index.php?option=com_xxx&view=xxx&tmpl=component
Since you are using Joomla 1.5 you can request index2.php?option=com_xxx&view=xxx and it will only render the component. Joomla 2.5 does not have index2.php so if you plan to migrate in future, don't use this option.
If you are using SEF then adding ?tmpl=component at the end on URL does the trick.
To go a step deeper... in your template directory you have component.php file, that is the file that's being loaded by tmpl param. You can copy component.php to my_component.php, do necessary changes and load your custom component template with index.php?option=com_xxx&view=xxx&tmpl=my_component
The joomla way of doing it would be to set your output to "raw", see this tut:
http://www.katcode.com/displaying-raw-output-in-joomla-by-setting-format-in-the-component/

How to use a JUMI file in AJAX callback on Joomla

I'm trying to use a JUMI file (a component for Joomla that allows me to get aceess to Joomla MVC) in AJAX callback. The structure is like this:
file.php that calls AJAX file is already a JUMI file.
file ajax.js (included in file.php) makes the call.
file.tooltip.php is a JUMI file which output is shown on file.php. It needs to be a JUMI because I need to access Joomla libraries to get the data it processess.
To prevent the problem that JUMI outputs a file with all the template I'm using in the Joomla call method in the end of the url in ajax.js: &tmpl=component. It works, but however it brings together all other calls for javascripts and so on contained in the template, which is bringing me to conflicts. The page is very slow and other javascript components are not working.
Does anyone know how is the best way to approuch the situation and get to a solution?
Thanks a lot!
You need to use &format=raw at the end of the url to the file you're ajax'ing to. Chances are though, that you get a server error because that "view is not supported". Easy fix, go to your site
root/components/com_jumi/views/application/
then make a copy of view.html.php called view.raw.php.
This component REALLY needs to be updated.
So you have a file, file.php, that has something like this in it?
<script type="text/javascript">
$(document).load( function() {
$('#this_id').click(function() {
$('#that_id').hide();
});
});
</script>
<div id="this_id">click me</div>
<div id="that_id">hello and goodbye!</div>
And then you want to access a file called "file.tooltip.php" that is also a Jumi file?
I don't know why that would need to be a Jumi file, it could be a simple php file that gets called in your javascript. To access the underlying Joomla libraries, you would simply invoke the appropriate library in the PHP file.
I hope this helps...
Bud

create a widget to retrieve and display data via ajax

I tried the classic ajax approach, but that throws an access denied javascript exception when trying to add a script stored on another domain.
Now, I'm sure this is possible since google populates google ads via js only; so does twitter, and the list can continue.
How I thought of it so far:
<div id="divId"></div>
<script type="text/javascript" src="http://mysite.com/script.js"></script>
The script in script.js should have changed the innerHTML attribute of the div above. Instead, I get the following message in fireBug: Access to restricted URI denied code: 1012
I googled around a bit but only found workarounds that are useless, like php proxies and such, whereas I want this widget to be copy-pasted into other peoples sites, blogs, forums, etc..
Thanks in advance for any helpful replies. :)
The behavior that you are seeing is intended and there for security reasons. You wouldn't want a third party script to make any changes to your page as that can be exploited heavily.
Instead, give your users a JavaScript snippet to embed on their page.
<script>
// do stuff here
</script>
Note that inside this snippet you can create a script tag dynamically, set the src attribute and load the actual JavaScript. This snippet that your users embed on their page has access to the entire DOM, but the script loaded externally does not.
Here's an example of the profile widget that Twitter gives out to embed on web pages:
<!-- external js, can't access or change the DOM -->
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<!-- local js, does that -->
<script>
new TWTR.Widget({
version: 2,
..
..
}).render().setUser('hulu').start();
</script>
The first script tag loads the library, while the second one which actually manipulates the page is added as code directly.
I finally found a solution that doesn't involve ajax.
I simply use
<div id="objectId"></div>
<script type="text/javascript" src="http://mysite.com/getAndDisplayData.php"></script>
<script type="text/javascript">getAndDisplayData();</script>
And in getAndDisplayData.php I generate a JS script that will create my widget inside the div above. The php file also connects to the database and retrieves all required widget data.
Apparently this is how google ads works, though I am not sure. It is certain though that they don't use ajax.

Resources