[Xerte-dev] Re: Youtube RSS
Julian Tenney
Julian.Tenney at nottingham.ac.uk
Tue Jul 7 11:20:33 BST 2015
OK, so where would you put the code to create a javascript variable from the php vars defined in the api_keys file?
-----Original Message-----
From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat Lockley (Pgogy)
Sent: 07 July 2015 11:18
To: For Xerte technical developers
Subject: [Xerte-dev] Re: Youtube RSS
Play is what all play request urls go to (or was) Ignore everything in https://github.com/thexerteproject/xerteonlinetoolkits/blob/develop/play.php
before line 181
The first DB query gets the info on the project, include its template type line 205 loads that template type play library
(https://github.com/thexerteproject/xerteonlinetoolkits/blob/develop/modules/xerte/play.php)
Then a load of logic happens based on the project display options (is it private, is it password) eventually either show_template or dont_show_template is called (which lives in
https://github.com/thexerteproject/xerteonlinetoolkits/blob/develop/modules/xerte/play.php)
And this code displays things
There is JS you can mangle here
On 2015-07-07 06:03, Julian Tenney wrote:
> Hmm. I still get completely lost trying to figure out how play.php,
> play_html5.php, modules/xerte/play.php and so on all interoperate. It
> makes absolutely no sense to me what happens through those files at
> all.
>
> -----Original Message-----
> From: xerte-dev-bounces at lists.nottingham.ac.uk
> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Pat
> Lockley (Pgogy)
> Sent: 07 July 2015 10:48
> To: For Xerte technical developers
> Subject: [Xerte-dev] Re: Youtube RSS
>
> I declare global inside a function if the variable is global in scope
> and you wish to use it Which is a statement in php crazy scope
>
> so
>
> $yt_api = "blah";
>
> function yt(){
> global $yt_api;
> echo $yt_api;
> }
>
> would output "blah"
>
> You could add
>
> echo "<script> some javascript </script>";
>
> if that works
>
> On 2015-07-07 05:42, Julian Tenney wrote:
>> OK, here's where my .php stuff falls down: how to get a javascript
>> variable available to the code in the two models files: because the
>> files are not php files I can't do
>>
>> gapi.client.setApiKey('<?php echo $youtube_api_key; ?>');
>>
>> I created this file in the root (api_keys.php):
>>
>> <?php
>>
>> global $youtube_api_key = 'AIzaSyDzCQC9UsxpShswJUSqgMWuwbeIltZsOas';
>>
>> global $flickr_api_key = '8f6f38d31f048a90c436583a6ac92e47';
>>
>> ?>
>>
>> And then required_onced it in play_html5php and preview_html5.php
>> after the line that requires config.php:
>>
>> require_once(dirname(__FILE__) . "/config.php");
>>
>> require_once(dirname(__FILE__) . "/api-keys.php");
>>
>> and then got stuck as to how best to proceed.
>>
>> FROM: xerte-dev-bounces at lists.nottingham.ac.uk
>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] ON BEHALF OF Ron
>> Mitchell
>> SENT: 06 July 2015 14:59
>> TO: 'For Xerte technical developers'
>> SUBJECT: [Xerte-dev] Re: Youtube RSS
>>
>> yeah sounds like a plan but I'd suggest api_keys-dist.php or
>> api_keys-sample.php to follow the way moodle or wordpress do this.
>>
>> FROM: xerte-dev-bounces at lists.nottingham.ac.uk
>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] ON BEHALF OF Julian
>> Tenney
>> SENT: 06 July 2015 14:46
>> TO: For Xerte technical developers
>> SUBJECT: [Xerte-dev] Re: Youtube RSS
>>
>> Yes we do, there is hardcoded key in the flickr model file as well
>> (presumably mine) which we should also split out, but I think that's
>> it.
>>
>> So perhaps we need an api_keys.php file that defines the vars, and
>> you rename it from api_keys.txt ?
>>
>> FROM: Tenney Julian
>> SENT: 06 July 2015 14:42
>> TO: 'For Xerte technical developers'
>> SUBJECT: RE: [Xerte-dev] Re: Youtube RSS
>>
>> Do we use any other API keys anwhere?
>>
>> FROM: xerte-dev-bounces at lists.nottingham.ac.uk
>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] ON BEHALF OF Ron
>> Mitchell
>> SENT: 06 July 2015 14:42
>> TO: 'For Xerte technical developers'
>> SUBJECT: [Xerte-dev] Re: Youtube RSS
>>
>> Just a quick comment to confirm that adding my own key works fine.
>>
>> We obviously do need to get this working in a way that future
>> upgrades don't break locally added keys.
>>
>> FROM: xerte-dev-bounces at lists.nottingham.ac.uk
>> [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] ON BEHALF OF Julian
>> Tenney
>> SENT: 06 July 2015 12:04
>> TO: For Xerte technical developers (xerte-dev at lists.nottingham.ac.uk)
>> SUBJECT: [Xerte-dev] Youtube RSS
>>
>> Hi,
>>
>> I've got the youtube rss working with a hardcode API key. Before we
>> release the code we can split that out and provide a file for people
>> to store their own keys in and read that. I'd appreciate someone
>> peer-reviewing my code: couple of questions:
>>
>> We need to load the google api which I've done by simply adding…
>>
>> <script
>> src="https://apis.google.com/js/client.js?onload=googleApiClientReady
>> [1]"></script>
>>
>> …to the top of the file.
>>
>> The onGoogleApiClientReady function is defined in global scope so I
>> wondered how to make it part of the youtuberss object, but if I
>> simply define it within the object, it doesn't get called (obviously).
>>
>> I think Fay or John will have an idea how to make all this nice and
>> graceful! I've committed the file (you'll need an API key!)
>>
>> Let me know comments,
>>
>> J
>>
>> This message and any attachment are intended solely for the addressee
>>
>> and may contain confidential information. If you have received this
>>
>> message in error, please send it back to me, and immediately delete
>> it.
>>
>> Please do not use, copy or disclose the information contained in this
>>
>> message or in any attachment. Any views or opinions expressed by the
>>
>> author of this email do not necessarily reflect the views of the
>>
>> University of Nottingham.
>>
>> This message has been checked for viruses but the contents of an
>>
>> attachment may still contain software viruses which could damage your
>>
>> computer system, you are advised to perform your own checks. Email
>>
>> communications with the University of Nottingham may be monitored as
>>
>> permitted by UK legislation.
>>
>> This message and any attachment are intended solely for the addressee
>>
>> and may contain confidential information. If you have received this
>>
>> message in error, please send it back to me, and immediately delete
>> it.
>>
>> Please do not use, copy or disclose the information contained in this
>>
>> message or in any attachment. Any views or opinions expressed by the
>>
>> author of this email do not necessarily reflect the views of the
>>
>> University of Nottingham.
>>
>> This message has been checked for viruses but the contents of an
>>
>> attachment may still contain software viruses which could damage your
>>
>> computer system, you are advised to perform your own checks. Email
>>
>> communications with the University of Nottingham may be monitored as
>>
>> permitted by UK legislation.
>>
>> This message and any attachment are intended solely for the addressee
>> and may contain confidential information. If you have received this
>> message in error, please send it back to me, and immediately delete
>> it.
>>
>> Please do not use, copy or disclose the information contained in this
>> message or in any attachment. Any views or opinions expressed by the
>> author of this email do not necessarily reflect the views of the
>> University of Nottingham.
>>
>> This message has been checked for viruses but the contents of an
>> attachment may still contain software viruses which could damage your
>> computer system, you are advised to perform your own checks. Email
>> communications with the University of Nottingham may be monitored as
>> permitted by UK legislation.
>>
>>
>>
>> Links:
>> ------
>> [1] https://apis.google.com/js/client.js?onload=googleApiClientReady
>>
>> _______________________________________________
>> Xerte-dev mailing list
>> Xerte-dev at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>
> --
> Pgogy Webstuff
> pgogywebstuff.com
>
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
>
>
>
>
> This message and any attachment are intended solely for the addressee
> and may contain confidential information. If you have received this
> message in error, please send it back to me, and immediately delete it.
>
> Please do not use, copy or disclose the information contained in this
> message or in any attachment. Any views or opinions expressed by the
> author of this email do not necessarily reflect the views of the
> University of Nottingham.
>
> This message has been checked for viruses but the contents of an
> attachment may still contain software viruses which could damage your
> computer system, you are advised to perform your own checks. Email
> communications with the University of Nottingham may be monitored as
> permitted by UK legislation.
--
Pgogy Webstuff
pgogywebstuff.com
_______________________________________________
Xerte-dev mailing list
Xerte-dev at lists.nottingham.ac.uk
http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
More information about the Xerte-dev
mailing list