A simple Big Click function

The following function is useful when we wish to make a certain area clickable. This takes in the first link, and makes the entire area clickable. This code has support for normal links as well as external links.

Necessary JS:

function cw_bigclick(){
    if($('.cw-bigclick .bigitem').length){
        $('.cw-bigclick .bigitem').on('click', function() {
            if ($(this).find('a').length > 0) {
                if($(this).find('a').attr('target')=='_blank'){
                    window.open($(this).find('a').attr('href'));
                }else{
                    window.location.href= $(this).find('a').attr('href');
                }
                return false;
            }
        });
    }
}

Expected HTML

<div class=”cw-bigclick”>
<div class=”bigitem”>
<a href=”#”></a>
</div>
<div class=”bigitem”>
<a href=”#” target=”_blank”></a>
</div>
</div>

Teeseract and JOIN tables using a CSV field

Latest News allows us to use content elements within a News. This opens up a vast set of possibilities.

However, when we look in depth, the news manages related content element IDs in a CSV format.

Now this seems like a bad way to mange it, as we do not have a mm_table, and there is no easy way to handle this, than using DB specific functions.

Luckily Tesseract supports most of the MYSQL functions, and thus we can make use of the FIND_IN_SET function here.

ex:
select tt_content.uid,tt_content.header, news.content_elements
FROM tx_news_domain_model_news AS news
LEFT JOIN tt_content
ON find_in_set(tt_content.uid, news.content_elements) WHERE news.uid=1

Hope this helps you.

Wrapping Long URLs that is inside A tag

I wanted to wrap long line/URL in an A tag, we surely did not wish to apply it for the p tag, or any other tag as such.

So the following solution worked well for me, note the “display:inline-block”.

.content p a{
-ms-word-break: break-all;
word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
display: inline-block;
}