473,796 Members | 2,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2742
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.supernew s.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.remov e.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.remov e.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($ima ges,"http://www.url.com/images/img1.jpg");
array_push($cap tions,"This is image one";

#Add image two:
array_push($ima ges,"http://www.url.com/images/img2.jpg");
array_push($cap tions,"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>$caption s[$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.sa y("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
3259
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 about hot scripts, etc. but I was wondering if any one could recommend one? Secondly, I also want to setup a journal. It's not really a "blog" although I guess blog software may work. But it isn't going to be a message board or anything like...
3
2328
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. I am a real beginner in programming. I am making a baking recipe site. For each section, say cookies, I will have around 100 recipes, which will be named sequentially, 001.html - 100.html for example.
9
12338
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 Access a way of adding records to a access database from a simple web page. I don't want to have to setup ODBC or anything like that I just want to put the web page on the network for anyone to access. Most of the users would use the local access...
0
1898
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 have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
27
4625
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 = $doc->loadHTMLFile("./aBasicSearchResult.html"); if ( $res == true ) { $zip = $doc->getElementById('zipRaw_id')->value; if ( 0 != $zip ) {
3
1691
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 / passwords; config vars on top of script * uses MySQL or a plain file (still no doubles) next to the .php (best both options)
7
9924
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 should be required (so I am not talking about a perl script in a form). I only want to call this script automatically when someone load the web page. How can I do this ? If necessary the perl script could return a value (e.g. a picture resp....
24
6342
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 have on his site, a Javascript Calculator for working out the cost of what they want, for example: 1 widget and 2 widglets = £5.00
5
10649
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 know that bindings exists for a LUA/c# integration, but only using the binary DLL. However, I would prefer a native c# solution and for a small language, not a huge interpreter like Python. Has anybody seen such implementation ? Thanks,
2
1683
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 to advance the use of the URL as a DSL for specifying 3 traits : content,its delivery ,and its behaviour on the web through the use of Returnable elements embedded within web pages .
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10467
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.