hack to display a clean 'title' within images cp

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
Post Reply
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

hack to display a clean 'title' within images cp

Post 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.
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post 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
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
pSouper
Posts: 1552
Joined: Tue 11. Nov 2003, 15:45
Location: London
Contact:

thanks

Post 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 :) )
User avatar
baklavoni
Posts: 170
Joined: Mon 23. Oct 2006, 00:48
Location: Bosnia and Herzegovina

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

Post 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
There is no page like home page...
User avatar
markus s
Moderator
Posts: 654
Joined: Sat 16. Dec 2006, 19:21
Location: Radfeld / Tirol
Contact:

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

Post by markus s »

@Sanjin:
its build with "joomla" ...
not a wcms site !
moderator
propelled by fresh air from tirol
XING|FACEBOOK|OMENTO
User avatar
baklavoni
Posts: 170
Joined: Mon 23. Oct 2006, 00:48
Location: Bosnia and Herzegovina

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

Post 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...
There is no page like home page...
Post Reply