Jump to content
IPSGoza

Our side block


The most important meat of the guide is the block that holds all the information and display that information onto the page. Here I will show how you create that block. 

Navigate in AdminCP > Page Management > Block

block.pngNote: Your database name doesn't have to be called help guide but it does help we use the correct database that will show the block on. 

Details

  • Name: Name of the block (can be called anything).
  • Template Key: Name will be used to show on the page that will allows the block appear.

Feed Configuration

The main thing we really wanted to focus is number to show. This number also includes <h3> title as part of the count. Keeping it really high will ensure everything will show; if it doesn't show up, increased the number until the content is shown. Everything else in the feed configuration is community preference. 

Content

Drop down: use as a base for a custom template

{{$recordClass = null;}}
{{$catClass = null;}}

{{if count($records)}}
{{$recordClass = get_class($records[0]);}}
{{$catClass    = '\IPS\cms\Categories' . $recordClass::database()->_id;}}
{{endif}}

{{$firstRecord = null;}}
{{$currentUrlPath = \IPS\Request::i()->url()->data['path'];}}

{{if count($records) and $catClass and count($catClass::roots())}}
<ul class="ipsList_reset cGuides" data-controller="guides.main">
    {{foreach $catClass::roots() as $root}}
    <li>
        <h2>{$root->_title}</h2>
        {{if count($root->children())}}
        <ul class="ipsList_reset">
            {{foreach $root->children() as $child}}
            <li class="cGuides_closed">
                <h3 data-action="expandSection">
                  {$child->_title}
              	</h3>
                {{foreach $records as $record}}
                {{if $record->container()->_id == $child->_id}}
                <ul class="ipsList_reset">
                    {{if $firstRecord == null}}
                    {{$firstRecord = $record;}}
                    {{endif}}
                    <li>
                        <a {{if $currentUrlPath === $record->url()->data['path']}}class="cGuides_active"{{endif}} href="{$record->url()}">
                            {$record->_title}
                        </a>
                      	{{if $record->isFutureDate() || $record->mapped('pinned') || $record->mapped('featured') || $record->hidden() === -1 || $record->hidden() === 1 || $record->hidden() === -2}}
            {{if $record->isFutureDate()}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->futureDateBlurb()}'><i class='fa fa-clock-o'></i></span></span>
            {{endif}}
            {{if $record->hidden() === -1}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span></span>
            {{elseif $record->hidden() === -2}}
                <span><span class="ipsbadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->deletedBlurb()}'><i class='fa fa-trash'></i></span></span>
            {{elseif $record->hidden() === 1}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span></span>
            {{endif}}
            {{if $record->mapped('pinned')}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span></span>
            {{endif}}
            {{if $record->mapped('featured')}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span></span>
            {{endif}}
        {{endif}}
                    </li>
                </ul>
                {{endif}}
                {{endforeach}}
            </li>
            {{endforeach}}
        </ul>
        {{endif}}
        <ul class="ipsList_reset">
            {{foreach $records as $record}}
            {{if $record->container()->_id == $root->_id}}
            {{if $firstRecord == null}}
            {{$firstRecord = $record;}}
            {{endif}}
            <li>
                <a {{if $currentUrlPath === $record->url()->data['path']}}class="cGuides_active"{{endif}} href="{$record->url()}">
                    {$record->_title} 
                </a>
              	{{if $record->isFutureDate() || $record->mapped('pinned') || $record->mapped('featured') || $record->hidden() === -1 || $record->hidden() === 1 || $record->hidden() === -2}}
            {{if $record->isFutureDate()}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->futureDateBlurb()}'><i class='fa fa-clock-o'></i></span></span>
            {{endif}}
            {{if $record->hidden() === -1}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->hiddenBlurb()}'><i class='fa fa-eye-slash'></i></span></span>
            {{elseif $record->hidden() === -2}}
                <span><span class="ipsbadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{$record->deletedBlurb()}'><i class='fa fa-trash'></i></span></span>
            {{elseif $record->hidden() === 1}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_warning" data-ipsTooltip title='{lang="pending_approval"}'><i class='fa fa-warning'></i></span></span>
            {{endif}}
            {{if $record->mapped('pinned')}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="pinned"}'><i class='fa fa-thumb-tack'></i></span></span>
            {{endif}}
            {{if $record->mapped('featured')}}
                <span><span class="ipsBadge ipsBadge_icon ipsBadge_positive" data-ipsTooltip title='{lang="featured"}'><i class='fa fa-star'></i></span></span>
            {{endif}}
        {{endif}}
            </li>
            {{endif}}
            {{endforeach}}
        </ul>
    </li>
    {{endforeach}}
</ul>
{{endif}}

{{if $recordClass and \IPS\cms\Pages\Page::$currentPage and (string) \IPS\cms\Pages\Page::$currentPage->url() == (string) \IPS\Request::i()->url()}}
    {{if $firstRecord}}
        {{\IPS\Output::i()->redirect($firstRecord->url(), '', 302);}}
    {{else}}
        {{\IPS\Output::i()->redirect(\IPS\Http\Url::internal(''), '', 302);}}
    {{endif}}
{{endif}}

 

×
×
  • Create New...