Guest
24 May 2013 11:08

I am using blog_list template for records list view

but in template .php file I see

<?php if($author):?><?php echo JText::_('Posted');?> <?php echo implode(', ', $author);?><?php endif;?>

                            <?php if($category):?> <?php echo JText::_('in');?> <?php echo implode(' ', $category);?><?php endif;?>

                            <?php if($details):?> <?php echo implode(', ', $details);?><?php endif;?>

I wanted to move the position of type - ctime - hits and comments

but it seems to me that they all are rendered by

or am I wrong?

maybe I shoul duse a different code to display those details (type, hits, comments...) in separate locations? is it possible?

Last Modified: 02 Mar 2014


Guest
24 May 2013 11:14

Solved,

I think I can simply use

type_name?>

and so on for all other details

sorry... I never really studied php :S


Guest
24 May 2013 11:18

another question...

I was able to put the "type" name right before the item title like this

<h2><?php echo $item->type_name ?>

                    <?php if($params->get('tmpl_core.item_title')):?>

                        <?php if(in_array($params->get('tmpl_core.item_link'), $obj->user->getAuthorisedViewLevels())):?>

                            <a <?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 endif;?>

                    <?php echo CEventsHelper::showNum('record', $item->id);?>

                </h2>

now how can I do to make the type name clickable to automatically filter the contents for that type, or at least add the filter clickable icon after it (but I would prefer the whole type name to be clickable with tooltip appearing)... I tried some php copy/paste in the template, but as I said I don't really know what I am doing...


Sackgesicht VIP
Total posts: 1,636
24 May 2013 21:15

To add the filter icon to the TYPE use this php code :

<?php echo $item->type_name .($params->get('tmpl_core.item_type_filter') ? FilterHelper::filterButton('filter_type', $item->type_id, NULL, JText::sprintf('Show all records of type %s', $item->type_name), $this->section) : NULL) ; ?> 

If you want to show the TYPE with a link use this:

<?php echo FilterHelper::filterlink('filter_type', $item->type_id, $item->type_name, $item->type_id, JText::sprintf('Show all records of type %s', $item->type_name), $this->section) ;?> 

Guest
25 May 2013 03:19

thanks Sackgesicht,

using your suggested code placed before the item title

<h2>

                    <?php echo FilterHelper::filterlink('filter_type', $item->type_id, $item->type_name, $item->type_id, JText:: sprintf('Show all records of type %s', $item->type_name), $this->section) ;?> 

                    <?php if($params->get('tmpl_core.item_title')):?>

                        <?php if(in_array($params->get('tmpl_core.item_link'), $obj->user->getAuthorisedViewLevels())):?>

                            <a <?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 endif;?>

                    <?php echo CEventsHelper::showNum('record', $item->id);?>

                </h2>

I get this error:

Fatal error: Call to a member function get() on a non-object in C:\wamp\www\joomla\components\com_cobalt\library\php\helpers\filter.php on line 22

I attach the template in case you or someone else whant to play with it


Sackgesicht VIP
Total posts: 1,636
25 May 2013 04:22

please use this :

echo FilterHelper::filterlink('filter_type', $item->type_id, $item->type_name, $item->type_id, JText::sprintf('Show all records of type %s', $item->type_name), $obj->section);

the change is $obj->section instead of $this->section and the php formatting inserted a space before sprintf in the last posting


Guest
25 May 2013 04:27

working! :D


Guest
25 May 2013 04:34

I need to take advantage of your knowledge while you are here...:)

any idea how I can manage separately the author name and "ctime" (posted date) ?

currently author name and ctime are rendered together with this code

I would need to amnage them separately so i can assign move each one of them in different positions

same questiojn for expired date and changed on date, they are all rendered all together by the above line of code I guess


Sackgesicht VIP
Total posts: 1,636
25 May 2013 05:30

To get the author use this : echo CCommunityHelper::getName($item->user_id, $obj->section) ;

Creation Time: echo JHtml::_('date', $item->created, $params->get('tmpl_core.item_time_format')) ;

Expiration date: echo JHtml::_('date', $item->expire, $params->get('tmpl_core.item_time_format')) ;

Changed Date: echo JHtml::_('date', $item->modify, $params->get('tmpl_core.item_time_format')) ;

Just keep in mind that the changed or expiration date might not be in use yet ..


Guest
25 May 2013 08:52

great :)

so now I inserted this


<?php echo JHtml::_('date', $item->created, $params->get('tmpl_core.item_time_format')) ;?> <?php echo JHtml::_('date', $item->expire, $params->get('tmpl_core.item_time_format')) ;?> <?php echo JHtml::_('date', $item->modify, $params->get('tmpl_core.item_time_format')) ;?>

how do I have to edit this code in roder to display the data only if they exist and they are enabled in template settings? is this very complicated?


Sergey
Total posts: 13,748
27 May 2013 04:39
expire != '0000-00-00 00:00:00'):?>
<?php echo JHtml::_('date', $item->expire, $params->get('tmpl_core.item_time_format')) ;?>

And other dates are always there.

Powered by Cobalt