Dannyboyonline Posted June 15, 2009 Share Posted June 15, 2009 I'm trying to figure out a way to effectivly display information on client sites, the same way google adsense, adbrite or basically any other PPC website out there, just by having my clients add some code to their website. Can someone please tell me what the best approach would be, such as should I use javascript, DHTML, iframes etc... Thank you Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/ Share on other sites More sharing options...
rhodesa Posted June 15, 2009 Share Posted June 15, 2009 i've written a couple of widgets in the past, and I usually used JS. really it comes down to what you want. If it's a large, complicated widget with LOTS of styling, you will probably want to go with iFrames. If it's something simple, you can probably get away with just JS Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856293 Share on other sites More sharing options...
Dannyboyonline Posted June 15, 2009 Author Share Posted June 15, 2009 It's only a couple of 125x125 images on it. What is this teqnique called? like using javascript to be used in this manner, I've been trying to find some guides online as to how to do it in a propper way. Although I know there's a ton of resources online as to how this is done I haven't managed to find the right place for it yet. Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856315 Share on other sites More sharing options...
rhodesa Posted June 15, 2009 Share Posted June 15, 2009 not sure what you will find out there...but you can just do: <script type="text/javascript">var clientId = 123;</script> <script type="text/javascript" src="http://www.your-server.com/widgets/widgetName.js"></script> Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856351 Share on other sites More sharing options...
shedokan Posted June 15, 2009 Share Posted June 15, 2009 and in your javascript file to write to the place the script tags are placed: document.write('<img/> or something'); Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856390 Share on other sites More sharing options...
Dannyboyonline Posted June 16, 2009 Author Share Posted June 16, 2009 hmm... ok thanks guys, well from the javascript samples I've seen online most people simply point to a javascript file that basically collects some information such as document.location.href and document.referrer then document.write an iFrame that basically calls some sort of script passing those variables with it... I was thinking that it would also be possible to actually creating a dynamic javascript file, whereby the website would use javascript.js.php?i=siteid as a javascript file, containing the dynamic data that is to be displayed for that site. I don't know if it's a good idea or not but from my thoughts my idea would result in a single request on the server against the first method I mentioned where two requests are required to first load the js file and then load the php file to fill the iFrame. what do you guys think I should do? Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856721 Share on other sites More sharing options...
rhodesa Posted June 16, 2009 Share Posted June 16, 2009 That should work. Keep in mind though, that an all in one request will slow the user's page load. By doing the bulk of the work in a request post page load, the client's page will load quickly still, and your stuff might just take an extra half second to show up. The choice is yours... Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-856838 Share on other sites More sharing options...
Dannyboyonline Posted June 16, 2009 Author Share Posted June 16, 2009 oh ok, thank you verry much Link to comment https://forums.phpfreaks.com/topic/162247-displaying-info-on-multiple-sites-through-a-code-snippet/#findComment-857406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.