HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Different "Catalogue Display Type" according to situation

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#57075 (In Topic #12418)
Avatar

Well-settled

Hello,

Is there a way to use different display type in a block (BLOCK_MAIN_RECENT_CC_ENTRIES.tpl) according to whether I'm on front page or another page?

After some googling I found in a translation file this little snippet:

Code

The display type to render the category with (must be either ''="default for catalogue", '0'="boxes", '1'="list" or '2'="tabular"). Default: ''.

Located in [strings]BLOCK_main_cc_embed_PARAM_display_type
To make it more simple:

I want a category block to display Title Lists if I'm on front page (and FRONT_PAGE is _TRUE) and display Tabular listings if I'm anywhere else in the site. Any idea which template I should mess with?
Back to the top
 
Posted
Rating:
#57119
Avatar

Well-settled

Kinda patched it the hard way. Added a {$SET,FRONT_PAGE} in my main page at Welcome zone then switched category list display to tabular.

Now I will check whether the block is called from front page or not, making the template look different according to situation.
Quick snippet from my code follows for anyone who wants to do something like that, this is from CATALOGUE_DEFAULT_TAB_FIELD.tpl

Code

{+START,IF,{$EQ,{$GET,FIRST_PAGE},1}}
    {+START,IF,{$EQ,{CATALOGUE},reviews}}
                        {$INC,REV_COUNTER,1}
                  {+START,IF,{$EQ,{$REM,{$GET,REV_COUNTER},2},1}}
                        <td style="width:86px;"><a href="{$GET*,GOTO_URL}">
                        <div align="center" style="font-size:10px;">{$TRUNCATE_LEFT,{VALUE_PLAIN@},15}</div>
                  {+END}
                  {+START,IF,{$EQ,{$REM,{$GET,REV_COUNTER},2},0}}
                        <div align="center"><img src="{VALUE}" width="70" height="70"></div></a>
                        </td>
                  {+END}
    {+END}
{+END}
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: