473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Simple PHP script

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
Jul 17 '05 #1
4 2699
Jedispy wrote:
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

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.
Jul 17 '05 #2
I noticed that Message-ID: <10*************@corp.supernews.com> from
Jedispy contained the following:
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?


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/
Jul 17 '05 #3
Jedispy <je***************@yahoo.remove.me.com> wrote or quoted:
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?


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/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #4
På Wed, 18 Feb 2004 18:09:39 -0800, skrev Jedispy
<je***************@yahoo.remove.me.com>:
(...)
a simple script (...)
that displays the image, and a caption.
(...)
Can this be done? If so, how do I do it in PHP?


------ 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");
}
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Preston Crawford | last post by:
I'm looking to quickly get a photo album online. Very simple, thumbnails, a few pages, maybe a description, but hopefully a small script that's easy to edit and work into my existing site. I know...
3
by: Alan Clark | last post by:
Dear All I need to do something very simple with Javascript and have been looking all over the web for two days for a suitable script. I'm the kind of person who learns by seeing how it's done....
9
by: Pete | last post by:
Does anyone have a simple html vbscript or other type of snippet they can share that appends a record to a access database via ADO or DAO? I would like to allow users that don't have Microsoft...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
27
by: one man army | last post by:
Hi All- I am new to PHP. I found FAQTS and the php manual. I am trying this sequence, but getting 'no zip string found:'... PHP Version 4.4.0 $doc = new DomDocument; $res =...
3
by: robert | last post by:
I'm looking for a most simple but save opt-in mailing list script in php (linux Apache CGI, but shouldn't matter) best: * all in one single .php file; different functions by input vars /...
7
by: Wladimir Borsov | last post by:
I want to call a perl script myscript.pl in my cgi-bin from a HTML web page. This call should NOT use SSI (because in this case HTTPS://.... protocol is necessary). Furthermore NO button click...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
5
by: Joel | last post by:
In the course of my project, I must include some custom logic and would like to integrate a small script language in my application for that purpose. In C++, I used the LUA script language and I...
2
by: Bhasker V Kode | last post by:
Hi, I just wanted to share with everyone a new project that i'm launching today called the Returnable Project ( http://returnable.org ) Returnable serves as a open-platform architectural guide...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.