The Four Word Film Review Fourum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Return to my fwfr
Frequently Asked Questions Click for advanced search
 All Forums
 Off-Topic
 General
 coding question for benj

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert Email Insert CodeInsert QuoteInsert List
   
Message:

Smilies
Angry [:(!] Approve [^] Big Smile [:D] Black Eye [B)]
Blush [:I] Clown [:o)] Cool [8D] Dead [xx(]
Disapprove [V] Duh [7] Eight Ball [8] Evil [}:)]
Gulp [12] Hog [13] Kisses [:X] LOL [15]
Moon [1] Nerd [18] Question [?] Sad [:(]
Shock [:O] Shy [8)] Skull [20] Sleepy [|)]
Smile [:)] Tongue [:P] Wink [;)] Yawn [29]

   -  HTML is OFF | Forum Code is ON
 
   

T O P I C    R E V I E W
duh Posted - 03/09/2009 : 01:50:42
benj, I'm venturing into Json for cross domain javascript includes. I want to make it possible for some folks to include some content from my ASP pages on their html pages on other servers. I think javascript would be easiest for non-techies.

I figured out how to put a recordset into Json code and how to display the Json code.

Now I'm trying to figure out how to let it be readable on an eternal domain via javascript includes.

Any suggestions to get me headed in the right direction?

ETA:
benj I found this: http://www.sergeychernyshev.com/javascript/remoteloader/ and installed the demo files and ran them. They seem to work fine...now I need to figure out how to make this do onload includes.

ETA:
I figured out how to get it to show remote includes onload. kool
Now I need to go through the process of figuring out how to get it to iterate through a json file and display the data.
9   L A T E S T    R E P L I E S    (Newest First)
benj clews Posted - 03/10/2009 : 00:35:28
quote:
Originally posted by duh Improper Username

Thanks benj, you're a fabulous resource and peach for sharing your knowledge and experience.



No probs- just let me know how it goes
duh Posted - 03/09/2009 : 22:06:30
Thanks benj, you're a fabulous resource and peach for sharing your knowledge and experience.
benj clews Posted - 03/09/2009 : 21:58:20
quote:
Originally posted by duh Improper Username

Is there a way to make it dynamic so that it pulls the data from the host server each time?



You could, but it's fiddly, could hammer your server if the other websites are popular and not really necessary unless your data changes on a second by second basis.

If you still wanted to go ahead with this, your options are to either have the javascript hosted on your server return data AJAXed from another (probably ASP) page or you could change your server's configuration so a .js file is executed on the server the same way a .asp file is (i.e. the other websites would request a .js file, it'd execute as ASP code and return the javascript data described earlier)- but this last option could possibly cause other problems with regular .js files.

quote:

Windows servers don't have cron, but my host does offer a service that is similar.

What do you use to emulate cronjobs?



Never used Cron since I've always had root access to the server- in other words I use Windows' Task Scheduler. Another option you could try is to make it be fired off by, say, your first site visitor each day or hour or something.

quote:

mmm...can you have a remote javascript file trigger those updates? See, now that I found out that what I want is easy, I have to think of a way to make it hard again.




You could but the problem then once again comes down to running ASP code from a .js file. You'd need to use one of the two techniques I mentioned at the top of this post.
duh Posted - 03/09/2009 : 20:30:42
quote:
Originally posted by benj clews

quote:
Originally posted by duh Improper Username

benj id like to know more about your process and im also curious as to how we are able to remotely embed your fwfr js files im very intrigued by this and have been obsessing about it for a few days



I'd say the first thing you need to do (assuming you want to do this via ASP) is write an ASP page that creates the html you want inserted into these other websites.

After you've done that, make it so the html has...

document.write(' ');

...around around it.

Then write the ASP to write the whole lot to a file of type .js (say 'horsey.js').

After that, all you need do is provide the owners of these other sites with the javascript include, like so...

<script src="http://www.duhsite.com/horsey.js" language="JavaScript" type="text/javascript"></script>



mmmm SO, I've been trying to make this much harder than it has to be.

---
Is there a way to make it dynamic so that it pulls the data from the host server each time? I guess that's where the 'cross domain scripting' stuff comes in. However, I guess there would really be no advantage to doing it that way unless one had a site that had lots of constantly changing information? Oh duh... I just realized, that if one wanted the data js files to be updated every so often, all that is needed to is to set the ASP files to do the js file writes every so often... Windows servers don't have cron, but my host does offer a service that is similar.

What do you use to emulate cronjobs?

mmm...can you have a remote javascript file trigger those updates? See, now that I found out that what I want is easy, I have to think of a way to make it hard again.
benj clews Posted - 03/09/2009 : 17:12:23
quote:
Originally posted by duh Improper Username

benj id like to know more about your process and im also curious as to how we are able to remotely embed your fwfr js files im ver intrigued by this and have been obsessing about it for a few days



I'd say the first thing you need to do (assuming you want to do this via ASP) is write an ASP page that creates the html you want inserted into these other websites.

After you've done that, make it so the html has...

document.write(' ');

...around around it.

Then write the ASP to write the whole lot to a file of type .js (say 'horsey.js').

After that, all you need do is provide the owners of these other sites with the javascript include, like so...

<script src="http://www.duhsite.com/horsey.js" language="JavaScript" type="text/javascript"></script>
duh Posted - 03/09/2009 : 15:56:55
benj id like to know more about your process and im also curious as to how we are able to remotely embed your fwfr js files im ver intrigued by this and have been obsessing about it for a few days
benj clews Posted - 03/09/2009 : 13:16:53
quote:
Originally posted by duh Improper Username

Another reason I'm interested in the remote javascript approach is for making rss feeds.

How do you create your remote fwfr javascript feeds that we put on our websites?



Okay, so the basic trick is to provide a piece of javascript, hosted on your site, that external sites can then include via a <script> tag in their html.

That file you host is then essentially just a piece of javascript like this...

document.write('<b>Stallion details</b><br />Here are your stallion details');

How that javascript file comes to be is up to you- you could manually create it or, as I do, have it generated dynamically by a piece of ASP that queries the database to figure out what the html in the document.write needs to be. At the end of all that, it writes the .js file to your server.

That's really all there is to it. It really is the best solution I know of (in fact, I swiped the idea from the BBC) because it doesn't matter what code the linking site works off- it will work regardless and you have full control over what the linking site displays (you can easily change or even remove the content if you wish). The only proviso is that it won't work for site visitors who don't have Javascript enabled, but these are a dying breed.

As for rss, it's even simpler. The thing to know about rss is that there's no rule that says rss files have to end with .rss. Baring this in mind, you can write an ASP file that spits out the format rss readers expect, provide a RSS Feed Here link to your .asp file and voila- a dynamic rss feed.
duh Posted - 03/09/2009 : 12:28:54
benj, I'm uncertain now as to whether I even need json or xml either one.

Here's what I'm hoping to come up with, if it turns out to be feasible:

With Classic ASP, I set up a site that allows horse people to enter their stallions into a database and to have the horses' pedigrees and details displayed in the site's "stallion showcase."

Someone asked me to do the same thing, only for displaying this year's foals, and they wanted to know if I would install it on their site. A problem with that would be that if their sites are on a non-ASP enabled host, then my existing ASP code wouldn't work. Another problem might be that once my scripts were installed on their server, they could copy them and give them away. (It isn't that my stuff is so wonderful, but anyhow...)

I could have my site spit out plain versions (appearance to be modified with css) of their personal showcase pages that they could include on their sites with php xhttp--odds are most of the folks who would be wanting such a service are using php enabled sites. Perhaps that would be the better way to go, because code for that wouldn't be too hard for non-technies to paste into their own sites.

But, I'm thinking that a remotely loaded javascript solution might be the best, because many nontechie folks are somewhat familiar with javascript and have used it to put various effects on their pages.

Another reason I'm interested in the remote javascript approach is for making rss feeds.

How do you create your remote fwfr javascript feeds that we put on our websites?
benj clews Posted - 03/09/2009 : 10:54:02
I'll be honest... I've never used- no, never even looked at JSON in my life.

I guess my first question is what put you in mind to use JSON for this? I'm guessing this is something JSON lends itself well to, but I don't really know that much about it to know for myself. Anyway, the reason I ask is because this can actually be done very simply with pure classic ASP (as I do here on the syndicated content). The advantage of using ASP would be that I'm guessing you know it considerably better than JSON (whether it's better suited to the job or not) and so you'll be able to implement this quicker if you stick with pure ASP.

Anyhow, I'm not much help on the JSON front I'm afraid but let me know if you're interested in pursuing the ASP approach and I'll tell you how.

The Four Word Film Review Fourum © 1999-2024 benj clews Go To Top Of Page
Snitz Forums 2000