Connecting Tech Pros Worldwide Forums | Help | Site Map

Simple PHP script

Jedispy
Guest
 
Posts: n/a
#1: Jul 17 '05
Hello,
I'm pretty new to PHP, and for starters I want to create a simple script for
creating dynamic web pages.
Here is how I want it to work:
index.html has 4 thumbnail images on it.
When users click a thumbnail image, I want it to generate a dynamic web page
that displays the image, and a caption.

I'm not looking for anything fancy. I'm hoping that this can be done by
simply calling the file and the text string (for the caption). I know this
can be done utilizing a database, but I'm trying to see if PHP can handle it
by simply calling the objects themselves.

Can this be done? If so, how do I do it in PHP?

Jedispy



Mike Discenza
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Simple PHP script


Jedispy wrote:
[color=blue]
> Hello,
> I'm pretty new to PHP, and for starters I want to create a simple script
> for creating dynamic web pages.
> Here is how I want it to work:
> index.html has 4 thumbnail images on it.
> When users click a thumbnail image, I want it to generate a dynamic web
> page that displays the image, and a caption.
>
> I'm not looking for anything fancy. I'm hoping that this can be done by
> simply calling the file and the text string (for the caption). I know
> this can be done utilizing a database, but I'm trying to see if PHP can
> handle it by simply calling the objects themselves.
>
> Can this be done? If so, how do I do it in PHP?
>
> Jedispy[/color]


It is probably more than what you are looking for but I have a couple of
pages that do something like what you want. Feel free to take a look at
them if you want.

The first is the "photo browser"
(http://barrelofmonkeys.sytes.net/sou...oBrowser.phps). This will
read a directory for files that end in .desc. It parses them to get the
information about the images from it, then uses that to build the contents
of the page and display the images.

The second page is the part that shows an enlarged image
(http://barrelofmonkeys.sytes.net/source/showImage.phps). This is opened
through some javascript on the first page and simply shows an enlarged
image.

This work well for what I use them for. Feel free to use what you can from
the pages.
Geoff Berrow
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Simple PHP script


I noticed that Message-ID: <10388co27q0dn88@corp.supernews.com> from
Jedispy contained the following:
[color=blue]
>Hello,
>I'm pretty new to PHP, and for starters I want to create a simple script for
>creating dynamic web pages.
>Here is how I want it to work:
>index.html has 4 thumbnail images on it.
>When users click a thumbnail image, I want it to generate a dynamic web page
>that displays the image, and a caption.
>
>I'm not looking for anything fancy. I'm hoping that this can be done by
>simply calling the file and the text string (for the caption). I know this
>can be done utilizing a database, but I'm trying to see if PHP can handle it
>by simply calling the objects themselves.
>
>Can this be done? If so, how do I do it in PHP?[/color]

This may give you some ideas.

http://www.ckdog.co.uk/php/popupage.php

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Tim Tyler
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Simple PHP script


Jedispy <jedispy.remove.me@yahoo.remove.me.com> wrote or quoted:
[color=blue]
> I'm pretty new to PHP, and for starters I want to create a simple script for
> creating dynamic web pages.
> Here is how I want it to work:
> index.html has 4 thumbnail images on it.
> When users click a thumbnail image, I want it to generate a dynamic web page
> that displays the image, and a caption.
>
> I'm not looking for anything fancy. I'm hoping that this can be done by
> simply calling the file and the text string (for the caption). I know this
> can be done utilizing a database, but I'm trying to see if PHP can handle it
> by simply calling the objects themselves.
>
> Can this be done? If so, how do I do it in PHP?[/color]

Here's some demos of mine:

http://texturegarden.com/samples/?th...tion_diffusion
http://durian.timtyler.org/gallery/

Source is at:

http://mandala.co.uk/photograph_album/
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
Fred H
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Simple PHP script


På Wed, 18 Feb 2004 18:09:39 -0800, skrev Jedispy
<jedispy.remove.me@yahoo.remove.me.com>:
[color=blue]
> (...)
> a simple script (...)
> that displays the image, and a caption.
> (...)
> Can this be done? If so, how do I do it in PHP?[/color]

------ File show.php ---------------
<html><body>
<?php
#Arrays to store image urls and captions:
$images = array();
$captions = array();

#Put images and captions into the arrays.
#NB: This must be done pair-wize, or images
#and captions will become out of synch.

#Add image one:
array_push($images,"http://www.url.com/images/img1.jpg");
array_push($captions,"This is image one";

#Add image two:
array_push($images,"http://www.url.com/images/img2.jpg");
array_push($captions,"This is image two";

#And so on...

#Check if we can display an image and it's caption:
if(isset($img) && is_numeric($img) && isset($images[$img]) &&
isset($captions[$img])) {
#We can, so that's what we'll do:
echo "<img src='$images[$img]'><br>$captions[$img]<br>"
}

?>
</body></html>
------------------------------------

If you now call show.php like this:
http://www.domain.com/show.php?img=1
show.php will display image number one, with it's caption.

Now, you asked for "simple", and you got it. Simplar than
this it probably can't be done :-)

You would probably want to change how the image and the
caption is displayed though.


--
Fred H

void FredH::Contact() {
TextToSpeach.say("frode at age dee dee dot en oh");
}
Closed Thread