Forum Moderators: coopster

Message Too Old, No Replies

Include text?

         

Mavicator

6:43 am on Nov 7, 2004 (gmt 0)

10+ Year Member



I'm using the following code to display popups in a HTML window:

code on main page:
<a href="javascript:;" onClick="MM_openBrWindow('../../window.php?image=mg/latehistorical/mga_concept.jpg','','resizable=yes,width=560,height=435')">

code on popup page:
<img src="<?php echo ''.$_GET["image"].'';?>" border="0">

How do I include text on the popup page as well as the photo? Thanks.

eggy ricardo

9:14 am on Nov 7, 2004 (gmt 0)

10+ Year Member



I would do something like...

<?php
echo "<img src=\"{$_GET['image']}\" border=\"0\">";
echo "<p>TEXT HERE</p>";
?>

Hope this helps
Cheers

Mavicator

4:24 pm on Nov 7, 2004 (gmt 0)

10+ Year Member


I should have said the text for each photo will be different, therefore I need to specify the text for each one on the thumbnail page. Is there a way to do that? Thanks!

dreamcatcher

5:03 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are you storing the text?

You could set a switch statement and get text depending on which case is true. So lets say you have your text in strings, like this:

$image1 = "This is image one";
$image2 = "This is image two";

On your image page do something like:

switch($_GET['image'])
{
case "mg/latehistorical/mga_concept.jpg":
echo $image1;
break;

case "mg/latehistorical/something.jpg":
echo $image2;
break;
}

and so on

Might be best to put your text into an array and call it by numerical indices.

Hope that helps. :)

Mavicator

5:44 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



Sorry I'm such a code wimp. I barely get by in HTML so PHP is really straining the remaining electrons in my brain.

Bascially what I'm doing is calling a single page called "window.php" to display a photo enlargement. This file is called up from numerous other pages throughout the site. I was hoping to be able to include a block of text with the code of each thumbnail to keep it simple.

Here's an example of the pages I'm working on. The thumbnails have short captions but I'd like to include full descriptions on the popup page (window.php).

The complete code for the "window.php" page is as follows:

<html>
<head>
<title>Image Window</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="000000">
<div align="center">
<p><a href="javascript:window.close()"><img src="" border="0"></a></p>
<p><font color="#FFFFFF">Click image to close</font></p>
</div>
</body>
</html>

[edited by: jatar_k at 4:55 pm (utc) on Nov. 8, 2004]
[edit reason] removed url [/edit]

eggy ricardo

5:56 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



I think this project could benefit from the use of databases or something like that although that could be tricky if you have limited knowledge.

I eagerly await other peoples suggestions although i would personally follow the DB route.

Mavicator

6:03 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



Im famous for getting in over my head. :\

dreamcatcher

8:27 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The DB route it certainly a good idea, but if all you want is a few simple bits of text called at given points, personally I would load them in an array and call them from there. No point in unecessary server resources being used.

How many images do you have roughly?

Mavicator

9:14 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



I'd say around 200-250 photos. It will probably climb to 400-500 by the time I'm done. Some text may change here and there but not often.

I have no idea how to set up an array in PHP. Haven't done it since my Casio FX700P! Any suggestions where to learn? :)

eggy ricardo

9:26 pm on Nov 7, 2004 (gmt 0)

10+ Year Member



With that sort of volume i personally would definately look towards a database, even more so if you are wanting to expand it later.

At this point it could be worthwhile learning php and mysql (or some other db) by means of online tutorials or books or something. To get this to do what you want will probably take more than just us supplying code snippets to you.

Larry Ullman has a PHP & MySQL book which may be just what you need.

Hope this helps
Cheers
Richard

dreamcatcher

11:13 pm on Nov 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yeah, I agree with eggy ricardo, with so many photos, best to use a database to store your information.

There are enough online tutorials to help you get started I would think.

Mavicator

1:56 am on Nov 8, 2004 (gmt 0)

10+ Year Member



Thanks. I was hoping to be able to simply send the text the same way as the photo but as most things, it ain't always that easy!

I'll look up a database tutorial and see if it's worth the lose of brain cells to me to learn. ;)