Sorry to bother again.... how can I set the width now? Before it was set in
the document.getElementById('dismalglobal').style.width = "300px"; part,
but i'm not exactly sure how to eimplement that with the new code.
On Thu, Aug 15, 2013 at 12:28 PM, onenak <[email protected]> wrote:
> This was perfect. Thanks so much, you really are a generally cool guy. I
> think I should definitely also start learning javacsript, from the very
> beginning. It would be a lot of use later!
>
>
> On Thursday, 15 August 2013 10:30:21 UTC-4, jgeerdes [AJAX APIs "Guru"]
> wrote:
>
>> Right. So every time you re-declare function OnLoad() { you override the
>> old version of OnLoad. Also, it doesn't make a lot of sense to rewrite
>> essentially the same code, with just a couple of different strings, 50
>> times over and over. Try something more like this:
>>
>> <script type="text/javascript">
>> google.load('feeds', '1');
>>
>> function OnLoad(){
>> var controlOpts = [
>> {
>> feeds : [
>> {
>> title: ' ',
>> url: 'http://pragcap.com/feed'
>> }
>> ],
>> el : 'content1',
>> title : 'Pragmatic Capitalism'
>> },{
>> feeds : [
>> {
>> title: ' ',
>> url: 'http://feeds.feedburner.com/**
>> zerohedge/feed <http://feeds.feedburner.com/zerohedge/feed>'
>> }
>> ],
>> el : 'content2',
>> title : 'Zero Hedge'
>> },...
>> ];
>> for(var i = 0; i < controlOpts.length; i++){
>> BuildDFControl(controlOpts[i])**;
>> }
>> }
>>
>> function BuildDFControl(opt_options){
>> var options = opt_options.options || {
>> stacked : true,
>> horizontal : false,
>> numResults: 6,
>> displayTime : 500000
>> };
>> if(opt_options.title){
>> options.title = opt_options.title;
>> }
>> new GFdynamicFeedControl(opt_**options.feeds, opt_options.el,
>> options);
>> }
>>
>> google.setOnLoadCallback(**OnLoad);
>> </script>
>>
>>
>> A couple of things to note here. First, instead of having 50 different
>> OnLoad functions defined, you have just one which contains an array with
>> information for all of the feed controls you want to load. The OnLoad then
>> loops through the array and passes the information to a separate function
>> which constructs the various controls. You would add more feeds at the
>> ellipsis ( ... ). I think you should be able to figure that part out.
>>
>> jg
>>
>>
>>
>>
>> On Thu, Aug 15, 2013 at 9:03 AM, onenak <[email protected]> wrote:
>>
>>> Sure Jeremy,
>>>
>>> Basically, my html file loads the dynamicfeedcontrol.js from an external
>>> file (I just copied the google code and customized it a bit - you actually
>>> helped me with that) and then I load the feeds in the header like this:
>>>
>>> <script type="text/javascript">
>>>
>>> google.load('feeds', '1');
>>>
>>> function OnLoad() {
>>> var feeds = [
>>> {
>>> title: ' ',
>>> url: 'http://pragcap.com/feed'
>>> }
>>> ];
>>>
>>> var options = {
>>> stacked : true,
>>> horizontal : false,
>>> numResults: 6,
>>> displayTime : 500000,
>>> title : "Pragmatic Capitalism"
>>>
>>> };
>>>
>>> new GFdynamicFeedControl(feeds, 'content1', options);
>>> document.getElementById('**content1').style.width = "300px";
>>> }
>>>
>>> google.setOnLoadCallback(**OnLoad);
>>> </script>
>>>
>>> <script type="text/javascript">
>>>
>>> google.load('feeds', '1');
>>>
>>> function OnLoad() {
>>> var feeds = [
>>> {
>>> title: ' ',
>>> url:
>>> 'http://feeds.feedburner.com/**zerohedge/feed<http://feeds.feedburner.com/zerohedge/feed>
>>> '
>>> }
>>> ];
>>>
>>> var options = {
>>> stacked : true,
>>> horizontal : false,
>>> numResults : 6,
>>> displayTime : 500000,
>>> title : "Zero Hedge"
>>> };
>>>
>>> new GFdynamicFeedControl(feeds, 'content2', options);
>>> document.getElementById('**content2').style.width = "300px";
>>> }
>>>
>>> google.setOnLoadCallback(**OnLoad);
>>> </script>
>>>
>>>
>>> Basically, my header is loaded with roughly 50 of these separate feeds.
>>> I load them like this because I want to display each div in a separate
>>> container, not all of them in the same feed. So when I wanted to move all
>>> these scripts into an external file (and remove all the script opening and
>>> closing tags) it doesn't work - the website only loads the last feed at the
>>> bottom of the external file. I'm sure this is exactly like what you
>>> mentioned - a problem with loops. How can I successfully load all the
>>> different feeds externally? Thank you in advance, you are a great help.
>>>
>>>
>>> On Thursday, 15 August 2013 08:28:40 UTC-4, jgeerdes [AJAX APIs "Guru"]
>>> wrote:
>>>
>>>> You can load any JS you want from an external file. The issue with
>>>> loading the last feed only sounds like you're trying to load everything in
>>>> a loop and overriding previous loops. Post a link, and we'll take a look.
>>>>
>>>> jg
>>>>
>>>> On Wed, Aug 14, 2013 at 11:28 PM, onenak <[email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Sorry if this is a stupid question. I know that you can load the
>>>>> source code for the dynamic control feed in a separate file, but what
>>>>> about
>>>>> the actual code that loads it? You know, the whole "google.load('feeds',
>>>>> 1)
>>>>> etc stuff. I have tons of feeds sitting in my html file and I fear it will
>>>>> really bog down my site once it gets more traffic. I tried putting them
>>>>> all
>>>>> in an external js file and calling it, but the feed at the bottom of the
>>>>> external file was the only one to load.... any suggestions?
>>>>>
>>>>> --
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google AJAX APIs" group.
>>>>> To post to this group, send email to
>>>>> google-ajax...@**googlegroups.**com
>>>>>
>>>>> To unsubscribe from this group, send email to
>>>>> google-ajax-search-api+**unsubsc**[email protected]
>>>>> To view this message on the web, visit
>>>>> https://groups.google.com/d/**ms**gid/google-ajax-search-api/**be0**
>>>>> a0702-6658-40f3-8094-**e115176e6**4d6%40googlegroups.**com<https://groups.google.com/d/msgid/google-ajax-search-api/be0a0702-6658-40f3-8094-e115176e64d6%40googlegroups.com>
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/**group**/google-ajax-search-api?**hl=en?**
>>>>> hl=en<http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en>
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Google AJAX APIs" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to google-ajax-search-api+**unsubsc**[email protected].
>>>>> For more options, visit
>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>> .
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jeremy R. Geerdes
>>>> Generally Cool Guy
>>>> Des Moines, IA
>>>>
>>>> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan
>>>> Church!
>>>> http://www.**debraheightswesleya**n.org<http://www.debraheightswesleyan.org>
>>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google AJAX APIs" group.
>>> To post to this group, send email to
>>> google-ajax...@**googlegroups.com
>>> To unsubscribe from this group, send email to
>>> google-ajax-search-api+**[email protected]
>>> To view this message on the web, visit
>>> https://groups.google.com/d/**msgid/google-ajax-search-api/**
>>> b39d014d-ea66-45c0-becc-**8d1e08b231fd%40googlegroups.**com<https://groups.google.com/d/msgid/google-ajax-search-api/b39d014d-ea66-45c0-becc-8d1e08b231fd%40googlegroups.com>
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/**group/google-ajax-search-api?**hl=en?hl=en<http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en>
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Google AJAX APIs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to google-ajax-search-api+**[email protected].
>>> For more options, visit
>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>> .
>>>
>>
>>
>>
>> --
>> Jeremy R. Geerdes
>> Generally Cool Guy
>> Des Moines, IA
>>
>> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan
>> Church!
>> http://www.**debraheightswesleyan.org<http://www.debraheightswesleyan.org>
>>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Google AJAX APIs" group.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> To view this message on the web, visit
>
> https://groups.google.com/d/msgid/google-ajax-search-api/11e70183-9af1-438a-b6ab-a3e2288dfdea%40googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Google AJAX APIs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-ajax-search-api/1_FsZZjjgyc/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
--
You received this message because you are subscribed to the Google
Groups "Google AJAX APIs" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
To view this message on the web, visit
https://groups.google.com/d/msgid/google-ajax-search-api/CA%2BmJPzRyP39kgExJxaF5OetrsUQEdqj%3DurdSdTNKpWcPqETzUQ%40mail.gmail.com
For more options, visit this group at
http://groups.google.com/group/google-ajax-search-api?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.