Giorgi625 VIP
Total posts: 655
24 Jul 2016 12:01

Hello I have set "Limit title characters" to 25 but on module Records does not work and displayes full title if it has more characters. How can I solve this problem?

Last Modified: 25 Jul 2016


Giorgi625 VIP
Total posts: 655
24 Jul 2016 19:46

Sorry Now I guess what it is doing. I need different function. I need to display only first 25 characters of title. Can anyone give advice how to do it?


pepperstreet VIP
Total posts: 3,837
24 Jul 2016 21:53

Giorgi625 I have set "Limit title characters" to 25

Assuming you were talking about the "Type" parameter. It just limits the title input!

Giorgi625 I need to display only first 25 characters of title. Can anyone give advice how to do it?

Hello, do you have the "Advanced Table" list template? It has a parameter Number of Title Characters.
You might use that PHP for reference... it starts at line 262 at the beginning of the records loop:

<?php
    if((int)$params->get('tmpl_params.title_char')  && JString::strlen($item->title) > (int)$params->get('tmpl_params.title_char'))
    {
        $title = $item->title;
        $item->title = sprintf('<span rel="tooltip" data-original-title="%s">%s...</span>',
            htmlentities($title, ENT_COMPAT, 'utf-8'), JString::substr($title, 0, (int)$params->get('tmpl_params.title_char')));
    }
?>

The number "tmpl_params.title_char" comes from template parameter input field. You might replace it with a hard-coded value...

Hope this helps.


Giorgi625 VIP
Total posts: 655
25 Jul 2016 07:11
<div class="record-style">
        <a name="record<?php echo $item->id;?>"></a>
            <?php
            $author = JText::sprintf('CONDATE', JHtml::_('date', $item->created, $params->get('tmpl_core.item_time_format'))); 
             ?>
            <?php if($params->get('tmpl_core.item_title')):?>
                <?php if($this->submission_types[$item->type_id]->params->get('properties.item_title')):?>
                    <div class="title-text">
                        <span><?php  echo $author; ?>    
                            <?php if(in_array($params->get('tmpl_core.item_link'), $this->user->getAuthorisedViewLevels())):?>
                                <a class="cobalttitle" <?php echo $item->nofollow ? 'rel="nofollow"' : '';?> href="/<?php echo JRoute::_($item->url);?>">
                                    <?php echo $item->title?>
                                </a>
                            <?php else:?>
                                <?php echo $item->title?>
                            <?php endif;?>
                            <?php echo CEventsHelper::showNum('record', $item->id);?>
                        </span>
                    </div>
                <?php endif;?>
            <?php endif;?>
            <div class="clearfix"></div>
            <div >
                <?php foreach ($item->fields_by_id AS $field):?>
                <?php echo $field->result; ?>
                <span><a class="readmore" href="/<?php echo JRoute::_($item->url);?>"><?php echo JText::_('CREADMORE'); ?></a></span>
                <?php endforeach;?>
            </div>

        </div>

I have this code and chaged here <?php if($params->get('tmpl_core.item_title')):?> to code provided by you. Then I added field from advanced table xml file to my templates xml file but I get blank page. What I am doing wrong?


pepperstreet VIP
Total posts: 3,837
25 Jul 2016 21:46

Giorgi625 but I get blank page.

Always turn on Joomla error reporting to MAX. You should see warnings and/or fatal errors.


Your code is just a part of your template...
Which template did you use for reference?
Would you mind to attach an archive of your "working" template?

Also make sure you use the correct "fieldset" name to access your XML parameter.
Watch out for lines with <?php echo $item->title?>. That is where you have to use the "limit" code.

Powered by Cobalt