Page 1 of 1

hack to display a clean 'title' within images cp

Posted: Thu 27. Sep 2007, 22:43
by pSouper
hi all,
I am developing a new site in phpwcms and used the new 'lightbox' option witch is lovely :)

To make the lightbox caption look nice i used {RT}'s like [div_style] & [BR] to format it lovely... it works as expected and looks great.... BUT... the 'on hover tooltip' display's the HTML code :( ... SO... a few tweeks in the code and all is good again :)

I haven't addressed this issue anywhere other than for my own needs but it will show you the way if you too need this...

first: edit the includes/inc_front/img.func.inc.php fro maprox line 457
FIND...

Code: Select all

					// lightbox
					$table .= '<a href="'.PHPWCMS_IMAGES.$zoominfo[0].'" rel="lightbox['.$lightbox.']"';
					if($capt_cur) {
						$table .= ' title="'.parseLightboxCaption($capt_cur).'"';
					}
					$table .= ' target="_blank">';

AND REPLACE WITH...

Code: Select all

// lightbox
					$table .= '<a href="'.PHPWCMS_IMAGES.$zoominfo[0].'" rel="lightbox['.$lightbox.']"';
					if($capt_cur) {
					$pSoupCaption = preg_replace('/\[BR\]/',', ',$capt_cur);// replare [BR]'s with comma's
					$pSoupCaption = preg_replace('/\[(.*?)\]/','',$pSoupCaption);//strip [RT][/RT]'s
					$pSoupCaption = preg_replace('/\{(.*?)\}/','',$pSoupCaption);//strip {RT}'s
					$table .= ' title="'.parseLightboxCaption($pSoupCaption).'"';//HACK:pSouper: image tooltip sanitiser.
					}
					$table .= ' target="_blank" name="'.parseLightboxCaption($capt_cur).'">';
THEN... edit file /template/slimbox/js/slimbox.js
FIND... (approx line 82)

Code: Select all

				if (j == images.length){
					images.push([el.href, el.title]);
					if (el.href == link.href) imageNum = j;
				}

THEN REPLACE WITH...

Code: Select all

				if (j == images.length){
					images.push([el.href, el.name]);
					if (el.href == link.href) imageNum = j;
				}
then it's done.

--------
THE WHY'S...

the reason for this is that slimbox.js gets the info for its caption box from the 'title' element of the anchor link BUT so doe the browser when it display the 'on hover tooltip' so we need to change the slimbox.js to use the 'name' attribute for the caption box instead - then clean the 'title' while using the (processed) cation for the 'name' attribute.

hope it helps.

Posted: Sat 29. Sep 2007, 01:23
by StudioZ
PSouper strikes again :shock: :lol:
I love your scripts from overseas.
Thanks gain for sharing with us.
Bookmarked. I am sure it will be usefull at some point 8)

Cheers,

Yves

thanks

Posted: Sun 30. Sep 2007, 19:07
by pSouper
Thanks StudioZ, I will give a quick look at a site-wide hack soon. I think OG may look at something for this too (but done well :) )

Re: hack to display a clean 'title' within images cp

Posted: Fri 29. Feb 2008, 10:14
by baklavoni
Hello pSouper.

I have one question which is not related with this topic.
I'm interested how did you make search on http://www.polygonsoup.net ?
I love it! It looks great, and search results are shown on main space (CONTENT).
This is something I was trying to make, but without success.
Can you give me some hint?

Thanks in advance.

Regards
Sanjin

Re: hack to display a clean 'title' within images cp

Posted: Sat 1. Mar 2008, 11:21
by markus s
@Sanjin:
its build with "joomla" ...
not a wcms site !

Re: hack to display a clean 'title' within images cp

Posted: Sun 2. Mar 2008, 18:58
by baklavoni
markus s wrote:@Sanjin:
its build with "joomla" ...
not a wcms site !
:(

Is there any way to have search results in new page, without other content?
Something like pSouper did with Joomla...