|
|
|
01-05-2000, 04:20 PM
|
Postid: 43420
|
|
Visitor
Join Date: Dec 1999
Posts: 28
|
Perl or PHP?
A small part of my site is an image gallery (although it's not an image site). Currently, I'm just linking to the images in the standard manner of A HREF="filename.jpg" and opening the image all by itself, not in an HTML page. To simplify navigation on that area of the site I want to start loading the images on a regular page so that links, headers, footers, etc can be included. Needless to say, I don't want to go through the trouble of creating a new page for each image. I just want to create a single page template and load the image into it, using that one page no matter which image is requested.
That's easy enough to do in Perl, but I was wondering if PHP might be a better choice. Would it be easier in PHP, involve less processor overhead or faster (if it's possible at all)? Or, for this situation is Perl the way to go? One benefit, I'm semi-competent in Perl, but am in desperate need of a PHP for Dummies book.
|
|
|
01-05-2000, 04:28 PM
|
Postid: 43421
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Something simple like this would work - for example, let's call this showimage.php:
</font><font face="Courier" size="3">
<html>
<body>
<!-- whatever HTML you need... -->
<font color=#FF0000><img src="<? echo $PIC ?>"></font>
</body>
</html>
</font><font face="Verdana, Arial" size="2">
Then call it with something like showimage.php?PIC=something.gif. The one liner (red) will use the variable $PIC from the query string, and place it in the SRC attribute of the IMG tag...
You can of course get a lot more involved and use the image functions of PHP to determine the height/width of each image, file size, and so on, but this simple method will let you wrap any image in your common HTML.
Hope this helps.
------------------
Justin Nelson
FutureQuest Support
|
|
|
01-05-2000, 07:58 PM
|
Postid: 43422
|
|
Visitor
Join Date: Dec 1999
Posts: 28
|
Okay, now I'm going to slink away and feel stupid and toss away the 120 line Perl script that accomplished the same thing that PHP did with about 3 words.
Thanks for your help Justin, that coupled to the $HTTP_REFERER will do exactly what I'm looking for quickly and easily. I just wish I had possessed the common sense to ask before I wrote the script.
Now, in light of the fact that there isn't a "PHP for Dummies" (or in my case, "PHP for Complete and Utter Morons"  book, can anyone recommend a decent PHP reference book for the beginner? I truly hate using on-line resources and tutorials for things like this, I've always found it easier to work from a hard copy.
|
|
|
01-05-2000, 10:04 PM
|
Postid: 43423
|
|
Site Owner
Join Date: Aug 1999
Location: Metro Los Angeles Area
Posts: 7,398
|
I learned enough PHP from websites to put up a couple of small scripts. (I have one that takes input from a from, writes some data to a file, and mails of two separate e-mails with different content to two different addresses. I was pretty please with that.)
I used some of these sites to learn my stuff:
http://www.php.net
http://www.phpbuilder.com
http://www.e-gineer.com/e-gineer/phpkb/index.phtml
http://www.webmonkey.com
Somewhere from those sites, or links on them, I found a few decent tutorials that walked me through the basics. Enough to get a feel for how PHP works.
|
|
|
01-06-2000, 01:56 AM
|
Postid: 43424
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
http://www.amazon.com/exec/obidos/AS...956601-2612409
Good book (hope that doesn't line wrap...) - I picked it up as soon as it was released. I believe it's based on 3.0.7 but not a whole lot has changed since then, and this book is a good start. The CD comes with Apache, PHP, and Xtami (sp?) web servers for Unix and Windows platforms...
Hope this helps.
------------------
Justin Nelson
FutureQuest Support
|
|
|
01-06-2000, 01:52 PM
|
Postid: 43425
|
|
Fond of TAZ
Join Date: Feb 1999
Posts: 918
|
I picked up another PHP book (aimed more at Unix heads) from Barnes and Noble, but never saw at Amazon. I can't remember the name off hand, nor have I finished it, but when I find it in my pile of stuff, I'll post it here.
I found PHP frustrating until I realized that I was putting too much work into the code!
|
|
|
01-06-2000, 02:36 PM
|
Postid: 43426
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
With me it has been the opposite - I liked PHP a lot when I first discovered it. It was great for mail forms and many other simple taks. Then I started really pushing it's limits. When you have more than 300kb of PHP code (many many months of work), driving a few megabyte mySQL database which holds many tens of thousands of records, performing mySQL queries involving 5 table joins and slamming into mySQL's temp table size limits as well as PHP's execution time/memory limits, mathematical/variable type problems, browser/server timeout problems and so on... that is when it gets frustrating...
But that's way way off topic - the above use (image thing) is a great use of PHP - it's a simple task, for a simple language. Just always remember that a simple task might unexpectedly grow beyond the bounds of the language you choose, so be prepared...
------------------
Justin Nelson
FutureQuest Support
|
|
|
01-06-2000, 02:45 PM
|
Postid: 43427
|
|
FutureQuest, Inc.
Join Date: Jun 1998
Location: Franktown Colorado
Posts: 6,781
|
Quote:
|
Just always remember that a simple task might unexpectedly grow beyond the bounds of the language you choose, so be prepared...
|
LOL!
History:
<Deb> Gee Justin check out this idea!
<Justin> Yeah Deb, that would work. It'd be easy to code it
<Deb>Awesome! Go for it!
<Justin Minutes later> All done 
<Deb> Hmmm what if we add this and that to it?
<Justin> Hmmm ok... there ya go.
<Deb> GREAT! Hey why not add these and those as well?
<Justin hours later> hmmm Ok... there ya go.
<Deb> I like that! Can you add this and that and these and those and them too?
<Justin months into it> Ahhh, ok.. umm it's done?
<Deb> Yeah this is getting pretty kewl! Not done yet though..let's continue with these additional features and work toward adding all of those as well....
Deb
- The saga continues!
|
|
|
01-06-2000, 02:52 PM
|
Postid: 43428
|
|
Visitor
Join Date: Jan 1999
Location: Kissimmee, FL
Posts: 3,672
|
Deb> Can you change this and that?
Justin> But I thought you wanted it like this?
Deb> I did. But I think it would look better like this...
Justin> *sigh* okay, no problem...
Justin, days later> Ok, try it now.
Deb> Hmm... maybe move this over here, and that should be over there...
Justin> hang on...
Justin> Ok, try it now...
Deb> Hm, maybe it was better the original way from last week?
<long pause>
Deb> Justin, you there?
Deb> Justin? Hello?
Justin> orry, i ave to go get a ew keyoard... ack in a ew...
-----------
Justin
-- I love my job... I love my job... I love my job... I love my job... I love my job... I love my job...
|
|
|
01-06-2000, 02:59 PM
|
Postid: 43429
|
|
Registered User
Join Date: Oct 1999
Location: Salem, Oregon
Posts: 1,416
|
Would this count as public airing of dirty laundry?
I was about to say that all this talk of PHP makes me think I should start looking into it, but if this is what it brings people to...
Dan
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 visitors)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:09 PM.
|
| |
|
|
|