Linking images in 'images content type'

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
Pauli
Posts: 92
Joined: Mon 30. Aug 2004, 11:53

Linking images in 'images content type'

Post by Pauli »

Hello,
I really want to add links to the images in the two images content types. So I was thinking, why not add an extra field like the caption field, where you can add your links to each image, for example when using three images:

index.php?index
#
index.php?contact

(a # when no link is needed)

What do you think, am I on the right track?
cyrano
Posts: 1598
Joined: Sat 31. Jan 2004, 18:33
Location: Stuttgart
Contact:

Post by cyrano »

hi pauli,

yes this would be usefull

at te moment i use the following workarround:

I make the URL into the caption fields like this:

[EXT http://www.mydomain.com]go to site[/EXT]

This works fine, but not when clicking on to the images...
Gruß/ regards cyrano
--------------------------------------------------------
templates -> http://www.128.weitzelmedia.de
planepix -> http://www.planepix.de
XING -> https://www.xing.com/profile/Thomas_Weitzel3
Pauli
Posts: 92
Joined: Mon 30. Aug 2004, 11:53

Post by Pauli »

Alright, I did get it to work this way:
(I'm no programmer, as you can see, but sometimes I get things to work :) )

#1
use the Caption field as a Link field, by changing this piece of code in "include/inc_front/front.func.inc.php":

Code: Select all

			//Aktuelle Bildspalte ausgeben
			
						if(!$type) {
				$capt_cur  = ($imagelist[$key]["cap"]) ? html_specialchars(chop(base64_decode($imagelist[$key]["cap"]))) : '';
			} else {
				$capt_cur  = $imagelist[$key]["cap"];
			}
			
			$table .= '<td'.$image_align.$image_valign.$image_bgcolor.$image_class.'>'; //width="'.$imagelist[$key]["w"].'" 
																						//removed because no centered image
																						//possible
			$list_img_temp  = '<img src="'.$imagelist[$key]["pic"].'" '.$imagelist[$key]["wxh"].$image_border.$image_imgclass.' alt="" />';
			if($imagelist[$key]["zoom"]) {
				$open_popup_link = "$capt_cur";
				$table .= "<a href=\"".$open_popup_link."\">";
				$table .= $list_img_temp."</a>";
			} else {
				// if not click enlarge
				$table .= $list_img_temp;
			}
			$table .= "</td>";
and than use it in a 'images content type' like this (caption field):

index.php?id=2,2,0,0,1,0
index.php?alias
javascript:openwindow('http://www.website.com/phpwcms/index.php?alias');

as you can see, I can use it as a pop-up window too, by adding this code in the 'html head' of the template:

Code: Select all

<script language="JavaScript">
<!--
function openwindow(url)
{
window.open(url,'title',
'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=565,height=620,left=50,top=50');
}
// -->
</script>
Disadvantage is that I loose the Caption title on each image...

Ok, here's another way,

#2
use the Caption field as a Link & Caption field, by changing this piece of code in "include/inc_front/front.func.inc.php":

Code: Select all

			//Aktuelle Bildspalte ausgeben
			
						if(!$type) {
				$capt_cur  = ($imagelist[$key]["cap"]) ? html_specialchars(chop(base64_decode($imagelist[$key]["cap"]))) : '';
			} else {
				$capt_cur  = $imagelist[$key]["cap"];
			}
			$capt_tmp .= $capt_cur;
			$capt_row .= '<td'.$caption_valign.$caption_align.$caption_bgcolor.$caption_class.'>'.$capt_before.$capt_cur.$capt_after."</td>\n";
			
			$table .= '<td'.$image_align.$image_valign.$image_bgcolor.$image_class.'>'; //width="'.$imagelist[$key]["w"].'" 
																						//removed because no centered image
																						//possible
			$list_img_temp  = '<img src="'.$imagelist[$key]["pic"].'" '.$imagelist[$key]["wxh"].$image_border.$image_imgclass.' alt="" />';
			if($imagelist[$key]["zoom"]) {
				$open_popup_link = "index.php?$capt_cur";
				$table .= "<a href=\"".$open_popup_link."\">";
				$table .= $list_img_temp."</a>";
			} else {
				// if not click enlarge
				$table .= $list_img_temp;
			}
			$table .= "</td>";
and than use it in a 'images content type' like this (caption field):

Alias
Alias2
Alias3

So here I used $capt_cur twice, as Caption title AND as alias after index.php?

I hope you can follow me :)
It is certainly not perfect, but it is just so important for me & my client to add links to images the easy way...

Who can help to make this better?
The best way imo is to add an extra field for links to the 'images content type' but my knowledge is very limited, so.... anyone? ;)
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

It seems like OG also is working on it:

http://www.phpwcms.de/forum/viewtopic.php?p=31859#31859
http://www.studmed.dk Portal for doctors and medical students in Denmark
Pauli
Posts: 92
Joined: Mon 30. Aug 2004, 11:53

Post by Pauli »

Alrighty!
so one of my (clients) biggest issues is being solved...
I'm speechless :shock:
thx!
Post Reply