Categories Block

Discussion in 'Article Script / Article Directory Script' started by trevorl, Apr 5, 2016.

  1. trevorl

    trevorl New Member

    Hello I am using the publishing script.

    It is really cool.

    I would like to have just the categories block display on my homepage, I don't want the http://mysite.com/publishing to be the home page as it displays a list of articles which is not what I want.

    So is there some code I can use to display the categories in a block on my home page, A premade categories block would be cool btw. :)

    See the image included.

    Hope this is an easy one!

    Thanks for your time

    Attached Files:

    • az.JPG
      az.JPG
      File size:
      28.1 KB
      Views:
      9
  2. Greg

    Greg Super Moderator

  3. trevorl

    trevorl New Member

    Hi, thanks for your time to reply. I have seen this option, I did not want publishing as homepage as my home page is set up with custom settings etc,
    I would like categories block on my own homepage. Thanks for your advice though.
  4. olairmarcos

    olairmarcos Member

    Hello,
    Publishing script already has a block that displays a list of categories (Top Categories), you can make visible on any page of the site and in any position.

    To activate select the administration: CONTENT> BLOCKS> Top Categories.
    2016-04-05_132415.jpg

    Edit the block and disable the option: Visible everywhere
    Select the tabs below on which page (s) you want the block is visible. Save.
    2016-04-05_132926.jpg

    You can also select which position the block is visible.
    2016-04-05_133213.jpg

    :)
  5. trevorl

    trevorl New Member

    Hi, thanks for your suggestion I have tried this, this produces a list as opposed to the 2 column table view of all that you would get from publishing home page. The formatting is different.
  6. olairmarcos

    olairmarcos Member

    Well,
    Create a new type SMARTY block and enter the code below into the editor will have a block of plain categories.

    Code (Text):
    {foreach $top_categories as $top_category}
        <div class="ia-categories">
            <a href="{ia_url type='url' item='articlecats' data=$top_category}"{if $top_category.nofollow == '1'} rel="nofollow"{/if}>  
                {$top_category.title|escape:'html'}
            </a>
            <span> -- {$top_category.num}</span>
            <br />
        </div>
    {/foreach}
    2016-04-05_163934.jpg

    :)
  7. trevorl

    trevorl New Member

    Hi, excellent! thank you that would work, :)

    Do you know how to arrange that in two or three columns, I guess there could be a max limit set on the loop and another div created and the code repeated?

    Or am I over thinking it?
  8. trevorl

    trevorl New Member

    One problem, this only displays top categories, I need to display all categories?
  9. olairmarcos

    olairmarcos Member

    I've been searching,
    I think publishing script still does not have a way to see sub-categories on the page. It may be that future to be implemented by the team.
    At the moment it is what I have to report.
    To limit the number of items in the block top-categories access the publishing package configuration panel and change the value to your need.
    2016-04-06_012026.jpg

    :)
  10. trevorl

    trevorl New Member

    OK thank you for all you input, it is really appreciated.

    I will send a message to the team - I did find this and it worked to some degree but then would require arranging the divs to be next to each other.

    {foreach $top_categories|@array_slice:0:6 as $category}

    this shows the first 6 categories, As I only have 12 I could simply repeat it by using;

    {foreach $top_categories|@array_slice:7:13 as $category}

    I would just need the array value for the categories instead of top categories.

    Of course this would only really work for a small amount of categories and if I added more it would need changing. I think I will defer to the experts :)
  11. olairmarcos

    olairmarcos Member

    Another option would be to build a new menu with only the categories of articles. By clicking on the menu item directly opens the categories of articles published on the site. But this has to be done manually on the control panel. See the following figure categories menu.

    2016-04-06_130958.jpg
    ... good job.

Share This Page