Category Lineage from $_REQUEST call

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 18, 2011   (RSS)

Hello All -

I'm trying to derive the category lineage working backwards from a $_REQUEST function.

Let's assume the lineage is: 1:2:3

I then call category 3 using:

./index.php?category=3

I can return the category number by using:

$_REQUEST['category']

But from this point how do I workout what the parent category number is?

NB: I intend to use this code in the WHERE clause of a getRecords() call.

Thanks in advance.

:o/

Perch

Re: [Perchpole] Category Lineage from $_REQUEST call

By Jason - October 17, 2011

Hi Perch,

Once you've selected the current category, the parent number is part of that record. For example:

<?php echo $selectedRecord['parentNum']; ?>

So, in your example, if the record num of $selectedCategory is 3, then $selectedRecorc['parentNum'] would be 2.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Category Lineage from $_REQUEST call

Hi, Jason -

Thanks for such a speedy response.

I'm actually looking to find the parent category of the selected category.

In the above example - where the category lineage is 1:2:3 - when I select category 3 I need a way to look back up the branch to find category 2.

:o/

Perch

Re: [Jason] Category Lineage from $_REQUEST call

Brilliant. Thanks.

:0)

Perch