Moodle load an external javascript file from URL - php

I am using Moodle 3.1+. I want to load javascript from an external URL into Moodle. I have tried adding it through config file of theme using
$THEME->javascripts_footer = array('pusher.min');
But is not working. I want to integrate Pusher into Moodle and for that, I have to load the script from URL 'https://js.pusher.com/3.2/pusher.min.js'.

You may include library file like :
< script src="https://js.pusher.com/3.2/pusher.min.js"> in the footer file of your current theme.
It will load your library file.
Hope this will help you.

try
$PAGE->requires->js('https://js.pusher.com/3.2/pusher.min.js',true);
I think it will work.

Related

Place Joomla module outside of index.php

I have a php page that is just a page I am linking to, from index.php.
When I try to use jdoc include to place the module, it doesn't work.
Should I do something special to make this php page a part of the Joomla template? Should I make it an article? Or is there just another way to load this module?
You can use this extension https://extensions.joomla.org/extension/jumi/ and on it you can put the path of your php file.

Wordpress development theme link bootstrap.css to index.php not working?

I am developing my Wordpress theme from scratch and when I link my bootrap.css in my index.php file and then I go see what it looks like it did not work. Please if someone can help.
Do you have a link to the site that you're working on? I'd love to help but really need to see what you're doing. Here are a couple things you can try:
link bootstrap.css in the header.php template file. As long as the directory path is correct, you should be able to 'view source' on the page and click on the file link to confirm that the file's content has been loaded.
Don't forget that for bootstrap, you also need to load jquery (http://jquery.com/download/) as well as link to the bootstrap.js file. I usually link to jquery and the bootstrap.js file in the footer.php template file for your theme.
You can also always refer back to this basic template which bootstrap provides that should help you get started.
http://getbootstrap.com/getting-started/#template

How to check Trace or log file in YII?

I Want to use log functionality from YII and i am new to YII.
Can anyone guide me where is file location of logging content? or tracing content?
If you are using default Yii main.php file then all the logs go to your protected/runtime/application.log file. It will include standard Yii logs as well as you own Yii::log() calls too.

using require in codeigniter

I'm trying to use the uaparser.php library to detect the operating system, but when I use the following it just loads the github page for the library. This is the github page https://github.com/tobie/ua-parser/tree/master/php
<?php
require('uaparser.php');
?>
I've placed the file in my includes folder which resides in the Views directory. Perhaps, that is the source of the problem? Where would be an appropriate place to put this file?
I assume when you downloaded uaparser.php you clicked File->Save Page As... (or something simular). That is why the page loads when you require/include it.
Open up the local file uaparser.php and confirm that it is actually the php code and not the html of the page.
Doing this is fine anywhere you need it.
You can place this anywhere, but for codeigniter it should be in the 3rd party folder, but it doesn't matter.

wordpress integration with codeigniter base functions conflict

I have developed the CRM based web application what i need to do is to integrate the wordpres with my CI first i have the problem when i include the main WP file
require('./wp-blog-header.php');
in my one of the CI view file the error i was getting that function site_url() conflicts this function is the base function of both WP and CI ,although i found a solution to include the WP file in the main index.php file of CI but there is uncertainity too that after this the session library of CI stops working is.
How to show the posts of WP in the footer of my CRM?
When using include or require in my CodeIgniter views I make sure the files I am linking to are outside of the CodeIgniter application folder as I had trouble using files there because of some permission problems. My solution was to just keep a folder in my web directory. You also cannot use base_url or site_url CodeIgniter functions here since you want to get the server path not the web address of the file. So you can use the php variable $_SERVER['DOCUMENT_ROOT'] which will return the root of your web directory.
It might look something like this:
require($_SERVER['DOCUMENT_ROOT'].'wp-blog-header.php');
Which would work if wp-blog-header.php was in your web root directory.

Categories