Jump to content

Please I need help to create a custom block


pavero

Recommended Posts

Posted

Hi,

I’d like to add something for my forum that seems quite basic but I just can’t find the way to make it happen so I come to you for help :)

I'd like to add a widget that displays a record feed from the tutorials section (database on Pages). Also I'd like for the avatar to be replaced by the record image, and the author replaced by the category in which the tutorials is filed.

I tried creating a custom block but I didn’t manage to obtain what I want. I can see something that’s very close to what I need on the index of the InvisionPower forum.

invisionpower.JPG.7b66243117b33bde9042e2bce5688609.JPG

Can someone please help me create something similar for my forum ?

 

Posted

Thank you for your reply :thumbsup: I've found what you're refering to but I can't seem to get the code right... I tried using several models to help me start but it didn't work. 

Posted
2 hours ago, pavero said:

I tried creating a custom block but I didn’t manage to obtain what I want. I can see something that’s very close to what I need on the index of the InvisionPower forum.

That look in the screenshot will indeed appear if you create a Record Feed custom block from your database. You can modify the template of that block to achieve the customizations you want. So yeah, you are on the right track. But what is your specific question? I doubt someone will code the template for you and just provide it here for free. That would take too much time (for me at least). 

Posted

Hi all,

I finally made it ! This is my first plugin, it's a simple record feed but I've been trying to make it for few days now !  I'm happy to share if it can help other newbies like me :) 

This is a basic version, each person can decide to add other infos if needed (author, date). For me the record's title is enough.

I created a custom block and added this code :

{{if !empty( $records ) }}
<h3 class='ipsType_reset ipsType_sectionTitle'>Guides Récents</h3>
<div class='ipsPad_half ipsWidget_inner'>
<ul class='ipsDataList ipsDataList_large ipsDataList_zebra'>
{{foreach $records as $id => $record}}
                {{if ($id == 0)}}
<li class='ipsDataItem'>
<div class='ipsDataItem_icon'>
<img class='ipsImage ipsThumb_tiny' src="{file="$record->_record_image_thumb" extension="cms_Records"}" />
</div>
<div class='ipsDataItem_main ipsPos_middle'>
<a href="{$record->url()}" title="{lang="read_more_about" sprintf="$record->_title"}" class='ipsDataItem_title ipsType_medium'>{$record->_title}</a></div>
{{else}}
<li class='ipsDataItem'>
<div class='ipsDataItem_icon'>
<img class='ipsImage ipsThumb_tiny' src="{file="$record->_record_image_thumb" extension="cms_Records"}" />
</div>
<div class='ipsDataItem_main ipsPos_middle'>
<a href="{$record->url()}" title="{lang="read_more_about" sprintf="$record->_title"}" class='ipsDataItem_title ipsType_medium'>{$record->_title}</a></div>
{{endif}}
</li>
{{endforeach}}
</ul>
</div>
{{endif}}

I used 2 classes from another plugin to replace author avatar with record image. Every other classes are in IPS theme by default. Quite easy and no need to add anything in the CSS ;)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...