SwiTch101
Jan 21 2006, 03:57 PM
I have written an 800 line script in HTML for a banner, is it possible to turn that script into about 5 lines so that you can put it onto other websites and it will update automatically when the main one is changed. It is not just a picture so i'm not sure how to do it. Does anyone know?
leo
Jan 21 2006, 04:28 PM
you can use includes to place it onto other pages, that way you would only need update that one file and then it would automatically update on any page you call it into via an include.
the page you call it into would need to be .php and just place this to call it in
CODE
<?php
include 'banner.html';
?>
if your pages are html and you cannot change them to .php then use that same code i just gave, and in your .htaccess file place this
CODE
AddType application/x-httpd-php .htm .html
SwiTch101
Jan 21 2006, 08:48 PM
would that work if I gave the code to hundreds of other sites, and they can just put it onto their website and the banner will update everytime i change the main code?
sjthomas
Jan 21 2006, 09:55 PM
I think this really depends on what you want to achieve. If this is banner rotaion and you want to give other people links so they can add a link to your site, and then the banner that goes with the link periodically changes then your best bet would probably be using an image thats generated by PHP. Then you could give everyone the same link and just manage it yourself. If you want something a bit more advanced then you could give something like phpadsnew a try and just give out the code it generates to the people you want to link to you. The program does loads and will let you track clicks being sent to you as well as rotate your banners, manage them from your admin itnerface and split them up into zones.
But like I said, it all depends on what you want to do.
SwiTch101
Jan 21 2006, 11:48 PM
What i am trying to do is set up a site that is like pixel advertising but on a banner, people buy pixels on this banner, then there link is added to it with a small picture. This banner is going to go on over 100 websites so i need to give them a small code which will read from my main banner which i can edit. I have coded the banner but i'm not sure how to make it into a small code to give out
leo
Jan 22 2006, 09:42 AM
then yes, the code i gave will serve that purpose:)
just give them the include code
Waleed
Jan 22 2006, 12:20 PM
But first, make sure everyone you're handing it out to has PHP on thier servers or not. If people can't process PHP on thier servers, the include code you'll give them (which is in php) will be of no use to them.
SwiTch101
Jan 23 2006, 12:54 PM
ok thank you very much everyone
SwiTch101
Jan 23 2006, 07:58 PM
apparently there is a better method using javascript, do you know it or whether it is better?
Waleed
Jan 24 2006, 08:56 AM
I suggest php, mainly because I don't know about the javascript for this. But then many people have javascript disabled in thier browsers, so the banner ad concept would just collapse...
sjthomas
Jan 24 2006, 05:30 PM
If you look at this page:
http://www.boutell.com/newfaq/creating/include.htmlit goes through the options for including pages in other pages with the pros and cons for each. Personally I would go for the Javascript option. While its true what Waleed says its still a minority of uses and Google uses a similar technique for Adsense.
What I think would be the better option though would be to use PHP to generate an image, you'll have to look at some tutorials on how to do this and your server would have to support PHP. The advantage of this approach though is that you can just give a normal img html link to the people who want to display the banner, something like this:
CODE
<img src="www.mypage.com/bannerimage.php" />
And with you controlling the generation of that image you can add text to the image and all sorts. You could add an image map to the code you give out if you intend to make it into a number of links. I would recommend managing this from the back end as well. So get an image map and take in the coords of the click so a url that will look like:
http://www.yoursite.com/bannerclick.php?cl...clickCoordY=144Then you could update where that link gets directed to through your site, which would allow you to manage everything fairly easily. Although that may be overcomplicating it a bit.
Willy Duitt
Jan 24 2006, 07:02 PM
If you use an
input type="image" - which acts much the same as a sumbit BUT it also sends the x and y coordinates of where the image was clicked on to your server and from there it should be a simple matter to figure out which
pixel was clicked... You'll need to experiment with CSS styling in order to seamlessly include your form into your users site as a form is a block level element and will more likely than not push your users layout around - my example simply uses
display:inline you might also need margin, border none as well...
You don't even need php - all you need to do is to provide an image source and update that source on your server whenever changes are made... And the best way to serve a non-caching image is to append a querry and the date object to the image URI...
CODE
<form action="http://google.com" style="display:inline">
<input type="image" src="image.jpg" style="width:300px;height:200px">
</form>
Run that ^ using google as the form action and witness for yourself the passing of the x and y coordinates...
.....Willy
CBrown
Jan 24 2006, 08:38 PM
Using an iframe is always an option...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.