« December 2010»
M T W T F S S
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

[blog...]

02.12.2010
17:34

Proper Image Titles with perfectlightbox and Multipe Images in tt_news SINGLE View

I really like perfectlightbox by Benjamin Niediek and I'm using the current tt_news extension version 3.0.1 in several installations.

 

In one of those sites with tt_news a customer pointed out a problem with the image titles in lightbox view.  This only happens if you have several images. The title in lightbox view of every image keeps always the title of the first image.

 

This is really a tiny and anoying bug. That's why I tried to fix it and hopefully found a solution.

 

How it works:

Perfectlightbox used to overwrite the tt_news function imageMarkerFunc by its own one in the static/setup.txt:

 

 

### If dam_ttnews is also loaded do not include the imageMarkerFunc
[globalString = TYPO3_LOADED_EXT|tt_news|type=L] AND [globalString = TYPO3_LOADED_EXT|dam_ttnews|type=L]
## Do nothing
[else]
plugin.tt_news.imageMarkerFunc = tx_perfectlightbox->ttnewsImageMarkerFunc
[global]

 

But after several modifications in tt_news to enable OptionSplits (starting with 3.0.0?), the old function didn't work anymore. So, Ben   decided to comment this overloading in perfectlightbox. Unfortunately this led to the problem described above.

 

I took now the tt_news imageMarkerFunc() and copied most of the OptionSplit-work into the ttnewsImageMarkerFunc of perfectlightbox. This seems to fix the problem not only in tt_news SINGLE-view but also in SINGLE2-view (using OptionsSplit).

With the following Typoscript I tested my patch with tt_news and OptionSplit in SINGLE2-view:

 

 

plugin.tt_news {
archiveTitleCObject {
10.strftime = %B - %Y
}

getRelatedCObject {
20.strftime = %d.%m.%Y %H:%M
}
displaySingle {
# configures tt_news to use 3 image markers. The first
# image is rendered to marker 1, the last 2 images
# are renderd to marker 3, the rest will go to marker 2.
 imageMarkerOptionSplit = 1|*|2|*|3||3

image.file.maxW = 200|*|90|*|100||100
image.file.maxH = 200
# this configures tt_news to wrap only each "middle" (marker2) image
# with <div class="sv-img-small"> (div is closed later)
image.wrap = | |*|<div class="sv-img-small">|*| | || |

# This wraps all images in the first image marker to
# <div class="sv-img-big">|</div>.
# marker 2 and 3 will be wrapped to
# <div class="sv-img-small-wrapper">|</div>
imageWrapIfAny (
<div class="sv-img-big">|</div>|*|
<div class="sv-img-small-wrapper">|</div>
)
caption_stdWrap.required = 0

# This wraps the image caption in a <p> tag. have a look at
# the "middle" wrap which closes the div from above to surround
# the image and its caption
caption_stdWrap.dataWrap (
<p class="news-single-imgcaption">|</p>|*|
<p class="news-single-imgcaption">|&nbsp;</p></div>|*|
<p class="news-single-imgcaption">|&nbsp;</p>||
<p class="news-single-imgcaption">|&nbsp;</p>
)
}
 }

 

 


 

Yesterday, I sent my patch to Ben and I hope he won't find any new bugs. Then it might be in the next perfectlightbox bugfix release soon.

  •  
  • 1 Comment(s)
  •  
Hartmut Salzmann
27.04.2012
17:42
GREAT HELP!!!!

The solution, offered by Alexander, was very, very helpful to me. GREAT WORK!!! Thanks a lot!!!
 
I hope, the patch will be included in Ben's perfectlightbox.

Your comment

Notify me when someone adds another comment to this post

back

[ 07.05.2012 ]