Webmaster Forum


Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Share |
  #1 (permalink)  
Old 02-04-2004, 09:30 PM
JuggoPop's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-09-03
Posts: 4,284
iTrader: 0 / 0%
Coding a php Link Button

I am wanting to know what I would need to do to program a php Link button image... something that I can put in footers of phpBB or any php site that will pull an image from the php file. (might even work in html... I don't know)

I know that I once had a rotating image script that you used a php file instead of a gif or jpg and it randomly pulled an image from a directory assigned in the php file.

I want to do something like that, but I guess it would need to be an includes tag in php only, because I want to be able to change the image, the link on it, and the alt text on the image...

I want to include this in phpBB forum skins I work on and be able to update them all by changing one file on my servers.

I guess I kind of answered my own question here... just put in an includes file... and write the html there...

but is there another way that I am missing? maybe something that can work out of a img tag or something else?

just want to make sure I'm not missing something better, before I start something that I want to change later.

thanks for any info.
 
Reply With Quote
  #2 (permalink)  
Old 02-05-2004, 03:42 AM
Contributing Member
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 224
iTrader: 0 / 0%
Juggo, everything that I see that you are trying to do can be done with javascript, unless you need the image to be generated. Anytime that you can do something just as well client side, that is probably the better solution, because you are not running up the server memory.

Of course, it's a little after 6am here, so I might be missing the big piece of the puzzle
__________________
Web 2.0 Style
 
Reply With Quote
  #3 (permalink)  
Old 02-05-2004, 06:59 AM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
No I think Juggo had the right idea...
He wants many pages on other people's sites to retirieve his latest button graphic, link URL and image ALT text from Juggo's own server.

So a basic php include() should be fine, but, you could lighten the load on your server Juggo, by using an intermediate script...

basically the intermediate script checks how long since it last checked your server, and either goes to grab the (new) images ond code and remembers it for use for 1 month for example, or just uses the code it has already remmebered.

On your clietns page, include(getButton.php)
getButton.php checks the local file button.txt...
(button.txt has 2 lines, 1 is a time stamp, and 2 is the HTML code for the button.)
... getButton.php reads the timestamp, and decides whether it's been a long time since the last update. If YES, it retrieves the new HTML from your server and OVERWRITEs it to button.txt with a new time stamp; if NO it just prints the button HTML from the existing button.txt.

it might all be totally unnecessary, if the code retrieved from your server is not going to be processed (just printed into the page once it gets to your client's servers), and button is small, it probably will have very little impact on your server. Your logs wold even give an idea of how popular your clients' forums are!
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #4 (permalink)  
Old 02-05-2004, 01:11 PM
JuggoPop's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-09-03
Posts: 4,284
iTrader: 0 / 0%
that's sound good...
This came about because I have links to juggopop from that say "artist communy" (years old)... and it would be nice to change them without having to actually talk to the owner. As well as a button that I had deleted not realizing that it was still being pulled somewhere... they had like 50% of my 404 errors. so I went and made a new image and put it in the right path... and then I came up with the idea above.
 
Reply With Quote
  #5 (permalink)  
Old 02-05-2004, 02:11 PM
sim sim is offline
Banned
Latest Blog:
None

 
Join Date: 01-23-04
Posts: 1,098
iTrader: 0 / 0%
wouldnt you need the people who are linking to you to include the php file, or you going to do something like < img src='echo po2.net/image.php ?
 
Reply With Quote
  #6 (permalink)  
Old 02-05-2004, 02:51 PM
JuggoPop's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-09-03
Posts: 4,284
iTrader: 0 / 0%
I was thinking of the php being on their servers, but that file requesting information from mine... (I could be wrong)
 
Reply With Quote
  #7 (permalink)  
Old 02-05-2004, 02:54 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
yes thats possible... <?php @include("http://www.juggopop.com/getlink.php"); ?> is what the person would have to put on the site.. and the getlink.php on your site would just tell them the link.. youd have to have the trust of the other guy that you wouldnt change it and pot malicious code in.. like redirects.. popups.. he could do <pre></pre> and then fopen your script and only get 1st line.. if you want that script just tell me. dont feel like typing it out now
 
Reply With Quote
  #8 (permalink)  
Old 02-05-2004, 03:28 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
[code:1:dc48b68b5e]<?php echo include("http://www.juggopop.com/button.txt"); ?>[/code:1:dc48b68b5e]

*edit* sorry not "echo include()" just "include()" !!!!
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #9 (permalink)  
Old 02-05-2004, 03:31 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
and on your web space u but u're button code in a text file such as the real file here: http://dev.jdenny.co.uk/button.txt
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #10 (permalink)  
Old 02-05-2004, 03:34 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
sorry not "echo include()" just include() !!!!
lol witht he echo it put a 1 in there too - the success flag returned from include()
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #11 (permalink)  
Old 02-05-2004, 03:46 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
I'm not sure if the include() fucntion will always work when you pass it a URL, it may depend on your clients' PHP configuration.

But anyway here's a file on my web space so you can try includ()ing an external file with your script...
http://dev.jdenny.co.uk/button.txt
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #12 (permalink)  
Old 02-05-2004, 03:59 PM
sim sim is offline
Banned
Latest Blog:
None

 
Join Date: 01-23-04
Posts: 1,098
iTrader: 0 / 0%
You want them to run a php file on there server just for one link to you? I wouldnt do it. Besides, what about people who dont have php on there servers.
 
Reply With Quote
  #13 (permalink)  
Old 02-05-2004, 04:15 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
We are talking about the difference between a link, and a link that can be updated in one palce and automatically cascade the update to all other sites.

It's one of the core functions the Web was designed for...
- yeah Sim - let's not bother u must be right and Tim Berners-Lee is a crack-pot !
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #14 (permalink)  
Old 02-05-2004, 04:45 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
you definitely want to use @include.. otherwise if your webserver was down they would get a stupid error.. the @ suppresses the error.
 
Reply With Quote
  #15 (permalink)  
Old 02-05-2004, 04:47 PM
LazyJim's Avatar
v7n Mentor
Latest Blog:
None

 
Join Date: 10-13-03
Location: UK
Posts: 2,469
iTrader: 0 / 0%
oooh that's what it is, i rmember now!
thanks for the tip!
__________________

-LJ-

My advice is to look at each case individually, with an informed mind and an appropriately balanced and objective viewpoint.

Web Design and Development, Ipswich, UK.
My deviantArt
 
Reply With Quote
  #16 (permalink)  
Old 02-05-2004, 04:50 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
no problem.. im not coder of the month for nothing
 
Reply With Quote
  #17 (permalink)  
Old 02-05-2004, 04:57 PM
JuggoPop's Avatar
Senior Member
Latest Blog:
None

 
Join Date: 10-09-03
Posts: 4,284
iTrader: 0 / 0%
lol... Wish I knew more about this stuff.

The whole point in this is that if I make a phpBB skin (which would be running on php) I could add that to the overall footer... and if I needed to change the link to my site I could... it's to keep the link updated as needed... otherwise they get a broken link and/or image in their footer. (which some people don't know enough about phpBB to actually remove the broken junk.

so now that you all have posted stuff...
can you explain a little more about the echo, and @ and what I really need to do here?

thanks.
 
Reply With Quote
  #18 (permalink)  
Old 02-05-2004, 05:00 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
well.. if you just make it do like
[code:1:c165ad3a1b]<?php @include("http://www.juggopop.com/getinfo.php"); ?[/code:1:c165ad3a1b]
and on your getinfo.php page you just have [code:1:c165ad3a1b]<a href="http://www.juggopop.com/">JuggoPop</a>[/code:1:c165ad3a1b]
then all would be fine.. the @ supresses any error msg (if ur site is down) .. no need for any echo.. unless you wanted to PHP script the getinfo.php page..
 
Reply With Quote
  #19 (permalink)  
Old 02-05-2004, 05:38 PM
Contributing Member
 
Join Date: 10-12-03
Location: Cranberry Township
Posts: 224
iTrader: 0 / 0%
@include will work, but it will only surpress the error after the timeout, which could be a problem depending if your server goes down. You will definately want to test the socket first, IMO and die a little more gracifully if it is not there. I still would caution you on this, as this should be a client side function, IMO, unless I am missing the fact that you are generating the image on the fly.
__________________
Web 2.0 Style
 
Reply With Quote
  #20 (permalink)  
Old 02-05-2004, 06:23 PM
kwvarga's Avatar
v7n Mentor
 
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 2,527
iTrader: 0 / 0%
oh yeah.. i think a public mysql server would be best.. where it connects to mysql to retrieve the line.. i just came in late and @include is to be used instead of include for offsite scripts/data
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i link the button not the box?? CircleOfLinks Web Design Lobby 2 02-21-2007 04:44 AM
php coding, java coding, webdesign, windows coding... SVB SEO Forum 5 02-24-2004 10:25 AM
Tell me about coding of button. sachin0404 Web Design Lobby 2 01-30-2004 08:45 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 07:36 PM.
Powered by vBulletin
Copyright © 2000-2013 Jelsoft Enterprises Limited.
Copyright © 2003 - 2013 Escalate Media LP




Search Engine Optimization by vBSEO 3.6.0 RC 2 ©2011, Crawlability, Inc.