Results 1 to 5 of 5

Thread: IndexU Category specific blocks addon

  1. #1
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default IndexU Category specific blocks addon

    Here's a nice simple addon you can use to make a block have specific information/data depending on what category your visitor is viewing. The block also can has default text for when a visitor is not viewing a category (such as the index, hot links, new etc).

    The addon may be downloaded at A-V Tronics - Winnipeg Web Design And Hosting

  2. #2
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Readme/Instructions

    Current Version 1.00 released for IndexU 5.40. The Category Specific Block Addon should work with any 5.x version of IndexU but it has not been tested on any other version not stated here.

    Until now, all blocks were considered global, that is, text in a block stays the same no matter where on the site you are. This addon/mod will allow users to have specific text in a block depending on what category a user is viewing. This can be a great addition for selling category specific advertising, privately entered sponsored links or anything else you can think of that may be shown that is specific to each category.

    This mod works both with and without mod_rewrite.

    While this addon/mod does require a lot of user input, it also allows for default text to be displayed in case any category is not specifically entered.

    This mod requires the following file: block.catmod.php

    This mod also requires one of the following files depending on the theme you are using
    blackjuice/block.catmod.html
    bluesmooth/block.catmod.html
    cleandex/block.catmod.html
    kosmos/block.catmod.html
    portaldex/block.catmod.html
    worlddex/block.catmod.html
    There is no text to change in block.catmod.php. This file gets uploaded to /your/path/to/indexu/blocks/

    The file block.catmod.html gets uploaded to /your/path/to/indexu/themes/yourtheme/blocks/

    CHMOD block.catmod.html to either 777 or 666 depending on your system.

    Inside the block.catmod.html you will find the following
    <%if $cat == 1%>
    This IS category #1
    <%elseif $cat == 2%>
    This IS category #2
    <%elseif $cat == 3%>
    This IS category #3
    <%elseif $cat == 4%>
    <%block_links1%>
    <%else%>
    This is NOT a category listed
    <%/if%>
    A breakdown is provided below
    <%if $cat == 1%> <- If $cat (the category you are viewing)
    is equal to 1 then display the next line(s)
    This IS category #1 <- The text for Category 1, can contain
    any data including html

    <%elseif $cat == 2%> <- If $cat (the category you are viewing)
    is equal to 2 then display the next line(s)
    This IS category #2 <- The text for Category 2, can contain
    any data including html

    <%elseif $cat == 3%> <- If $cat (the category you are viewing)
    is equal to 3 then display the next line(s)
    This IS category #3 <- The text for Category 3, can contain
    any data including html

    <%elseif $cat == 4%> <- If $cat (the category you are viewing)
    is equal to 4 then display the next line(s)
    <%block_links1%> <- The text for Category 4, this shows how
    you can use a new block instead of text

    <%else%> <- If you are NOT in a category listed above, display
    the following data
    This is NOT a category listed <-- default data

    <%/if%> <- end of statement
    Users can add as many of the elseif statements as they wish. One thing you must remember is that if you have 100 categories or more this file can get quite large. You may want to simply call additional blocks instead of inserting the text into this block. That will help you to better organize your data.

    CHMOD
    After uploading, CHMOD block.catmod.html to 777 or 666

    Notes
    Depending on which theme you use you will need to add this block to your site. Typically this block will be added to footer.html. Open footer.html in your admin panel and add
    <%block_catmod%>
    where you would like the block to appear.

    License/Cost
    Provided free of charge within the limits of the included license file

    Troubleshooting/Problems
    Please leave me a message at the Nicecoder forum. Note that I will not respond to private messages unless there is a security issue with the provided script.

    Credits
    IndexU Category Specific Block Mod written by Bruce Peresky (A-V Tronics - Winnipeg Web Design And Hosting)

  3. #3
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    I noticed an error in one of the files today so I updated the package. If you had downloaded this and previously please download it again. With the original file the mod would not work properly (or at all).

  4. #4
    Join Date
    Jun 2002
    Location
    Winnipeg Canada
    Posts
    4,913

    Default

    Some people have asked why they should use this since it would require a statement for each category. Complaints were about there needing to be a HUGE file if they have a lot of categories.

    Another possibility is to number each main category as a 100, 200 300 etc (or 1000, 2000, 3000 etc) and place subcategories inside those number (101, 102, 103 etc). Then you can use the following for each category

    <%if $cat < 99%>
    The is default text for any category between 0 and 99
    <%elseif $cat < 199%>
    The is default text for any category between 100 and 199
    <%elseif $cat < 299%>
    The is default text for any category between 200 and 299
    <%else%>
    This is default text that will be shown when NOT in a category
    <%/if%>

    This way you could have text change between the major categories, and still display that text while in the subcats.

    You can see an example of this system working at http://dbdemo.avtronics.net

  5. #5
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    Another way you could do this is make a database field in idx_category called "blocktext" which you displayed in the block. Depends on what exactly you wanted this for though.
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

Similar Threads

  1. IndexU Invoice System addon
    By Bruceper in forum Blocks and Modification
    Replies: 9
    Last Post: 11-29-2007, 11:24 AM
  2. Specific number of links per category
    By ezykiwi in forum Blocks and Modification
    Replies: 0
    Last Post: 09-21-2006, 02:47 AM
  3. Importing Links to a specific category.
    By innstreet in forum v5.x
    Replies: 2
    Last Post: 06-02-2005, 03:46 PM
  4. Replies: 0
    Last Post: 07-11-2004, 03:22 AM
  5. Displaying Top Votes of a Specific Category
    By Hart_House in forum v5.x
    Replies: 2
    Last Post: 03-04-2002, 08:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •