Topic: Link to Category possible?

Hi guys,

Quick question, just like the title says:
Is it possible to link to a category?

Say I want to pass a url to someone that refers to all forums in that category.

Re: Link to Category possible?

This was possible using a mod on PunBB 1.2 that I have lying around on my PC somewhere I'm sure. I should have time to port it this weekend as I'm actually needing it myself before upgrading one of my larger forums to 1.3 smile

Re: Link to Category possible?

Hi Downliner,

Let me know if I can help...

cheers

4 (edited by downliner 2008-12-06 02:22)

Re: Link to Category possible?

Casemon wrote:

Let me know if I can help...

Well I'm still only learning PHP myself so if you think you may be able to help feel free to add me to MSN smile It should be listed in my profile.

Elbekko has actually already written an extension for linking to categories for Flux 1.3 Beta. I tried using it on PunBB 1.3.1 but the index page gave me undefined index/eval() errors. The below is a slightly modified version of Elbekko's extension (only the eval'd code removed). To install:

1. In your /extensions folder create a folder named: category_view

2. Copy the following code into Notepad and Save As manifest.xml in your category_view folder

<?xml version="1.0" encoding="utf-8"?>
<extension engine="1.0">
    <id>category_view</id>
    <title>Category View</title>
    <version>0.3</version>
    <description>Allows you to link to one or more categories</description>
    <author>El Bekko</author>
    <minversion>1.3 Beta</minversion>
    <maxtestedon>1.3 Beta</maxtestedon>
    
    <hooks>
        <hook id="in_qr_get_cats_and_forums">
            <![CDATA[
                if(isset($_GET['cat']))
                {
                    $cats = explode(',', $_GET['cat']);
                    $scats = array();
                    
                    foreach($cats as $cat)
                        if(round($cat))
                            $scats[] = round($cat);
                    
                    $query['WHERE'] = '('.$query['WHERE'].') AND c.id IN('.implode(',', $scats).')';
                }
            ]]>
        </hook>
    </hooks>
</extension>

To view a specific category the link would be for example:

http://www.mydomain.com/forum/index.php?cat=1

All credit goes to Elbekko. The original extension can be found here smile This is a working version of the extension. The one I was thinking of porting from 1.2 to 1.3 was originally written by Gizzmo I think, it allowed you to hide categories on the index page which you could then link to from your main menu. Was excellent if your forum homepage was getting a little cluttered and some categories were treated more like archives than actual forums cool I'll send Gizzmo a PM this weekend and see if he plans to port it himself first.

Re: Link to Category possible?

Am back (sorry, was unavailable this WE).

Will take a look at this. First glance looks like we have most of what we need, but I've never written a PunBB extension before, so might take me a few stabs.

Also, finding this code to be very violent & messy!

                    $cats = explode(',', $_GET['cat']);
                    $scats = array();

lol

Re: Link to Category possible?

I've been getting help from Garciat to get the port of the View/Hide Categories mod working as an extension. I'm just having difficulty with the Admin side of things but hopefully get it sorted soon for you to try out smile

$cats = explode

lol Brilliant