Template for "Rollover Images"

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
Stefan Johannsen
Posts: 8
Joined: Mon 31. Jan 2005, 16:06
Location: Denmark

Template for "Rollover Images"

Post by Stefan Johannsen »

Im using dev 121.

Where can I find the default template for "Rollover Images". It says "sample.html" and I can't find it.

If I want to make my own templates for the "Rollover Images" where can I place them so they appears in the list of templates?

Hope that I can make myself understandable with my poor english skills :?
Pappnase

Re: Template for "Rollover Images"

Post by Pappnase »

Stefan Johannsen wrote:Im using dev 121.

Where can I find the default template for "Rollover Images". It says "sample.html" and I can't find it.

If I want to make my own templates for the "Rollover Images" where can I place them so they appears in the list of templates?

Hope that I can make myself understandable with my poor english skills :?
hello

you will find the template here

Code: Select all

/phpwcms_template/inc_cntpart/reference
Stefan Johannsen
Posts: 8
Joined: Mon 31. Jan 2005, 16:06
Location: Denmark

Post by Stefan Johannsen »

Cool :-)

Thank you Pappnase!
Stefan Johannsen
Posts: 8
Joined: Mon 31. Jan 2005, 16:06
Location: Denmark

Post by Stefan Johannsen »

Is there any easy way to get the thumbnails in two horizontal colums instead of just one?
Pappnase

Post by Pappnase »

hello

i only test it with one row never test it with to rows so sorry!

i take a quick look to this content part and i would believe that it's onlz possible to use one row!
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Hi,

digging through the forum:
is there a possibility for adjusting the layout of thumbs (one/two/more rows/columns) in the meanwhile?
This would be really nice because having more than 10 thumbs for the cp bilderwechsel isn't really nicely displaying them anymore (just some pixels left to look at) :(

Any body any idea?

Greetings
claus
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

OK
it is cnt50.article.inc.php and now it's spitting out as many rows as neccessary, depending on the number of thumbnails - and the size of thumbs can be adjusted too :D
Greetings
claus
cmsler
Posts: 22
Joined: Mon 5. Jul 2004, 17:32

Post by cmsler »

..and what did you change? Because I need exactly the same solution.
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

Hi,
I think (I'm quite sure) I've found the changed file again :)
Every change is as follows: the old version commented out, the new one pasted into place, so if you do a quick file **** you will see the changes immideately (back up your original file first)
For me it worked, so give it a try
Ok, here it is (out of /include/inc_front/content:

Code: Select all

<?php
/*************************************************************************************
   Copyright notice
   
   (c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
 
   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.
  
   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license 
   from the author is found in LICENSE.txt distributed with these scripts.
  
   This script is distributed in the hope that it will be useful, but WITHOUT ANY 
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 
   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

// Content Type Reference

//$CNT_TMP .= headline(, $crow["acontent_subtitle"], $template_default["article"]);

$content['reference'] = unserialize($crow["acontent_form"]);
$content['reference']["tmpl"] = @file_get_contents(PHPWCMS_TEMPLATE.'inc_cntpart/reference/'.$content['reference']["tmpl"]);
if(!$content['reference']["tmpl"]) {

	$content['reference']["tmpl"] = '<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="1%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr><td>[REF]{REF}[/REF]</td></tr>
      [CAPTION]<tr><td>{CAPTION}</td></tr>[/CAPTION]
    </table>
    [LIST]{LIST}[/LIST]</td>
    <td width="14" valign="top">&nbsp;</td>
    <td width="98%" valign="top">[TITLE]<h3>{TITLE}</h3>[/TITLE]
[SUB]<h4>{SUB}</h4>[/SUB]
[TEXT]<p>{TEXT}</p>[/TEXT]</td>
  </tr>
</table>';

}



$content['reference']['ref_caption'] = '';
$content['reference']['ref_image']   = '[NO&nbsp;IMAGE]';
$content['reference']['ref_list']    = '';

// check if there is an image
$content['reference']['ref_count'] = count($content['reference']["list"]);
if($content['reference']['ref_count']) {

	// caption
	$content['reference']['caption_list'] = explode("\n", $content['reference']['caption']);
	$ci = 0;
	if(is_array($content['reference']['caption_list']) && count($content['reference']['caption_list'])) {
		foreach($content['reference']['caption_list'] as $captkey => $captvalue) {
			$content['reference']['caption_list'][$captkey] = html_specialchars(trim($captvalue));
			$ci++;
		}
		if($content['reference']['caption_list'][0]) {
			$content['reference']['ref_caption']  = '<div id="refcaptid'.$crow['acontent_id'].'" style="display:inline;">';
			$content['reference']['ref_caption'] .= $content['reference']['caption_list'][0];
			$content['reference']['ref_caption'] .= '</div>';
		}
	}
	for($ci; $ci < $content['reference']['ref_count']; $ci++) {
		$content['reference']['caption_list'][$ci] = '';
	}
	
	// javascript ID
	$content['reference']['ref_id'] = 'refimgid'.$crow['acontent_id'];
	
	// starting large image
	$thumb_image = get_cached_image(
						array(	"target_ext"	=>	$content['reference']["list"][0][3],
								"image_name"	=>	$content['reference']["list"][0][2] . '.' . $content['reference']["list"][0][3],
								"max_width"		=>	$content['reference']["list"][0][4],
								"max_height"	=>	$content['reference']["list"][0][5],
								"thumb_name"	=>	md5(	$content['reference']["list"][0][2].
															$content['reference']["list"][0][4].
															$content['reference']["list"][0][5].
															$phpwcms["sharpen_level"])
        					  )	);
	
	
	if($thumb_image != false) {
	
		//$img_name = html_specialchars($content['reference']["list"][0][1]);
		$content['reference']['ref_image']  = '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] ;
		$content['reference']['ref_image'] .= '" border="'.$content['reference']['border'].'" '; //.$thumb_image[3]
		$content['reference']['ref_image'] .= ' alt="" ';//title="'.$img_name.'" 
		$content['reference']['ref_image'] .= 'id="'.$content['reference']['ref_id'].'" name="'.$content['reference']['ref_id'].'">';
	
	}
	
	/*
	if($content['reference']["zoom"]) {
	
		$zoominfo = get_cached_image(
						array(	"target_ext"	=>	$content['reference']["list"][0][3],
								"image_name"	=>	$content['reference']["list"][0][2] . '.' . $content['reference']["list"][0][3],
								"max_width"		=>	$phpwcms["img_prev_width"],
								"max_height"	=>	$phpwcms["img_prev_height"],
								"thumb_name"	=>	md5($content['reference']["list"][0][2].$phpwcms["img_prev_width"].
														$phpwcms["img_prev_height"].$phpwcms["sharpen_level"])
        					  )	);
	
		if($zoominfo != false) {
			$popup_link  = 'image_zoom.php?show='.base64_encode($zoominfo[0].'?'.$zoominfo[3]);
			$content['reference']['ref_image'] =	'<a href="'.$popup_link.'" onClick="window.open(\''.$popup_link.
													"','previewpic','width=".$zoominfo[1].",height=".$zoominfo[2].
													"');return false;\">".$content['reference']['ref_image'].'</a>';
		}
	
	}
	*/
	
	if($content['reference']['ref_count'] > 1) {
		$ci = 0;
		// open table row if horizontal
		if($content['reference']['basis']) {
			$content['reference']['x1'] = "";//"<tr>\n";
			$content['reference']['x2'] = "";//"</tr>\n";
			$content['reference']['x3'] = '';
			$content['reference']['x4'] = "";//"</tr>\n";
		} else {
			$content['reference']['ref_list'] .= "";//"<tr>\n";
			$content['reference']['x1'] = '';
			$content['reference']['x2'] = "";//"\n";
			$content['reference']['x3'] = "";//"</tr>\n";
			$content['reference']['x4'] = '';
		}
		$content['reference']['x5'] = '';
		$content['reference']['x6'] = '';
		
		$content['reference']['x8'] = 0;
		if(preg_match('/\[CAPTION\](.*?)\[\/CAPTION\]/is', $content['reference']["tmpl"])) {
			$content['reference']['x8'] = 1;
		}
		
		// loop images
		foreach($content['reference']["list"] as $captkey => $captvalue) {
		
			$content['reference']['x5'] = '';
			$content['reference']['x6'] = '';
				
			// space between images
			if($ci && $content['reference']['space']) {
			
				$content['reference']['ref_list'] .= $content['reference']['x1'];
				$content['reference']['ref_list'] .= '<img src="img/leer.gif" alt="" ';//<td>'<img src="img/leer.gif" alt="" ';
				$content['reference']['ref_list'] .= 'width="'.$content['reference']['space'].'" height="';
				$content['reference']['ref_list'] .= $content['reference']['space'].'" border="0" vspace="5" />';//$content['reference']['space'].'" border="0" /></td>';

				$content['reference']['ref_list'] .= $content['reference']['x2'];

			}
			$content['reference']['ref_list'] .= $content['reference']['x1'];
			$content['reference']['ref_list'] .= ' <!-- ';//'<td';
			switch($content['reference']["pos"]) {
				case 1:	$content['reference']['ref_list'] .= ' align="left" valign="top"';		break;
				case 2:	$content['reference']['ref_list'] .= ' align="left" valign="middle"';	break;
				case 3:	$content['reference']['ref_list'] .= ' align="left" valign="bottom"';	break;
				case 4:	$content['reference']['ref_list'] .= ' align="center" valign="top"';	break;
				case 5:	$content['reference']['ref_list'] .= ' align="center" valign="middle"';	break;
				case 6:	$content['reference']['ref_list'] .= ' align="center" valign="bottom"';	break;
				case 7:	$content['reference']['ref_list'] .= ' align="right" valign="top"';		break;
				case 8:	$content['reference']['ref_list'] .= ' align="right" valign="middle"';	break;
				case 9:	$content['reference']['ref_list'] .= ' align="right" valign="bottom"';	break;
			}
			$content['reference']['ref_list'] .= ' //--> ';//'>';

			if($content['reference']["zoom"]) {
			
				// build additional reference popup images
				$zoominfo = get_cached_image(
						array(	"target_ext"	=>	$content['reference']["list"][$captkey][3],
								"image_name"	=>	$content['reference']["list"][$captkey][2] . '.' . $content['reference']["list"][$captkey][3],
								"max_width"		=>	$phpwcms["img_prev_width"],
								"max_height"	=>	$phpwcms["img_prev_height"],
								"thumb_name"	=>	md5($content['reference']["list"][$captkey][2].$phpwcms["img_prev_width"].
														$phpwcms["img_prev_height"].$phpwcms["sharpen_level"])
        					  )	);
			
	
				if($zoominfo != false) {
					$popup_link  = 'image_zoom.php?show='.base64_encode($zoominfo[0].'?'.$zoominfo[3]);
		
					$content['reference']['x5'] =	'<a href="'.$popup_link.'" onClick="window.open(\''.$popup_link.
													"','previewpic','width=".$zoominfo[1].",height=".$zoominfo[2].
													"');return false;\">";
					$content['reference']['x6'] = '</a>';
				}
	
			}

			$content['reference']['ref_list'] .= $content['reference']['x5'];
			
			$over_image = get_cached_image(
						array(	"target_ext"	=>	$content['reference']["list"][$captkey][3],
								"image_name"	=>	$content['reference']["list"][$captkey][2] . '.' . $content['reference']["list"][$captkey][3],
								"max_width"		=>	$content['reference']["list"][$captkey][4],
								"max_height"	=>	$content['reference']["list"][$captkey][5],
								"thumb_name"	=>	md5(	$content['reference']["list"][$captkey][2].
															$content['reference']["list"][$captkey][4].
															$content['reference']["list"][$captkey][5].
															$phpwcms["sharpen_level"])
        					  )	);
			
			
			$thumb_image = get_cached_image(
						array(	"target_ext"	=>	$content['reference']["list"][$captkey][3],
								"image_name"	=>	$content['reference']["list"][$captkey][2] . '.' . $content['reference']["list"][$captkey][3],
								"max_width"		=>	$content['reference']["temp_list_width"],
								"max_height"	=>	$content['reference']["temp_list_height"],
								"thumb_name"	=>	md5(	$content['reference']["list"][$captkey][2].
															$content['reference']["temp_list_width"].
															$content['reference']["temp_list_height"].
															$phpwcms["sharpen_level"])
        					  )	);
			
			if($thumb_image != false) {
	
				if(!empty($content['reference']['caption_list'][$captkey])) {
					$img_name = $content['reference']['caption_list'][$captkey];
				} else {
					$img_name = html_specialchars($content['reference']["list"][$captkey][1]);
				}
				$content['reference']['ref_list'] .= '<img src="'.PHPWCMS_IMAGES . $thumb_image[0] ;
				$content['reference']['ref_list'] .= '" border="'.$content['reference']['border'].'" ';
				$content['reference']['ref_list'] .= $thumb_image[3].' alt="'.$img_name.'" title="'.$img_name;
				$content['reference']['ref_list'] .= '" id="'.$content['reference']['ref_id'].'a'.$captkey;
				$content['reference']['ref_list'] .= '" name="'.$content['reference']['ref_id'].'a'.$captkey.'" ';
				
				// switch large image onmouseover
				$content['reference']['ref_list'] .= 'onMouseOver="';
				if($over_image != false) {
					$content['reference']['ref_list'] .= "MM_swapImage('".$content['reference']['ref_id'];
					$content['reference']['ref_list'] .= "','','". PHPWCMS_IMAGES . $over_image[0]."',1);";
				}
				// make single quotes js compatible
				$content['reference']['x7'] = js_singlequote($content['reference']['caption_list'][$captkey]);
				// check if layer for caption available
				if($content['reference']['x8'] && $content['reference']['caption_list'][$captkey]) {
					$content['reference']['ref_list'] .= "addText('refcaptid".$crow['acontent_id']."','";
					$content['reference']['ref_list'] .= $content['reference']['x7']."');";
				}
				$content['reference']['ref_list'] .= "MM_displayStatusMsg('".$content['reference']['x7']."');return ";
				$content['reference']['ref_list'] .= 'document.MM_returnValue;" />'.$content['reference']['x6'];//'document.MM_returnValue;" />'.$content['reference']['x6']."</td>\n";
				$content['reference']['ref_list'] .= $content['reference']['x4'];
	
			}
			$ci++;
		}
		// close table row if horizontal
		$content['reference']['ref_list'] .= $content['reference']['x3'];
		// wrap it in the table
		//$content['reference']['ref_list']  = '<table border="0" cellspacing="0" cellpadding="0">'.$content['reference']['ref_list'].'</table>';
	}
	
}


$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'TITLE', html_specialchars($crow["acontent_title"]));
$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'SUB', html_specialchars($crow["acontent_subtitle"]));
$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'TEXT', nl2br($content['reference']["text"]));
$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'CAPTION', $content['reference']['ref_caption']);
$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'LIST', $content['reference']['ref_list']);
$content['reference']["tmpl"] = render_cnt_template($content['reference']["tmpl"], 'REF', $content['reference']['ref_image']);


$CNT_TMP .= $content['reference']["tmpl"];

?>
Do a little bit of trial and error for the size of thumbs using the corresponding standard backend input page (where you can adjust the look and feel of this cp)
Greetings
claus
cmsler
Posts: 22
Joined: Mon 5. Jul 2004, 17:32

thank you

Post by cmsler »

thank you, that looks nice
User avatar
update
Moderator
Posts: 6455
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Post by update »

:oops: :D
User avatar
oeconom
Posts: 337
Joined: Fri 13. May 2005, 09:33
Location: Stuttgart
Contact:

Post by oeconom »

Hey folks,

is there also a way to aling the preview images vertically in a row top-down?
I found the respective template, but I wasn't able to figure out how to manage this best...

Thanks,
FELIX


P.S.: next to this, is there a way to predefine a fixed width/heigth to the preview images and images for this content part?

F.
...alles wird gut!
still alive...
Experimenting with phpwcms and hoping to have time one day to get a site live... :wink:
One Site finished! :P
User avatar
oeconom
Posts: 337
Joined: Fri 13. May 2005, 09:33
Location: Stuttgart
Contact:

Post by oeconom »

...wer lesen kann ist klar im Vorteil...
ok, first part solved as the CT itself supports alignment.

The second one still whould be an open question:
prefedining the images sized (not setting them on cration individually!)

Felix
...alles wird gut!
still alive...
Experimenting with phpwcms and hoping to have time one day to get a site live... :wink:
One Site finished! :P
Post Reply