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. ocPortal 9 is 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.


How to use Parent_ID in ocSelect?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#112081 (In Topic #22571)
TQ
Avatar

Honoured member

Hi Folks,

I have 2 zones for members, the Welcome Zone and a VIP Zone.

Both zones have downloads associated with them. To separate the VIP downloads I have created a parent category for them then created sub-categories below it.

|-Downloads Home
| |-Welcome Cat 1
| |  └-Cat 1 Sub Cat
| |-Welcome Cat 2
| └- etc.
|
└-VIP Downloads (155)
    |-VIP Cat 1
    |-VIP cat 2
    └-etc.


To display the appropriate 'Latest Download' (main_recent_downloads block) in the Welcome Zone I use the filter:

Code

category_id=*,!156,!157,!158,!159,!160

To display only those items that apply in the VIP Zone I use:

Code

category_id=*,156-160

It works but it is dependent on me remembering to add the categories as I expand the range in either zone.

Is it possible to step back a level so that I can somehow stipulate:

Code

parent_id=*,155
in the VIP zone and

Code

parent_ID=*,!155
for the welcome zone. If it is, I can't fathom it!

I have set out the downloads as described above because it is the only way I see to do it but if there is a better way PLEASE let me know as now would be a good time to fix it.

TQ
Back to the top
 
Posted
Rating:
#112083
Avatar

category=123* should select everything somewhere underneath #123 in the tree. i.e. includes subcategories.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#112085
TQ
Avatar

Honoured member

Hi Chris,

Thank you for replying.

Partial success, to INCLUDE all sub-categories of 155 I had to filter (extra *,):

Code

category=*,155*
.. but the most important part ie. excluding below the category 155, I just couldn't get to work. It's important because I don't want to accidentally display something that would then link an ordinary member to a ' xxx does not have access to this category'.

I also found that, when using '!', I had to exclude the category=

Code

Works
*,!156,!157,!158,!159,!160

Code

Returns nothing
category=*,!156,!157,!158,!159,!160
Strange ...

TQ
Back to the top
 
Posted
Rating:
#112086
Avatar

category=*,155* looks wrong.

The * is going to include everything and no clause there is disincluding anything.

To disinclude everything under category #155 you would do category=135~.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#112087
TQ
Avatar

Honoured member

category=155~ still included everything under it (156,157 etc). There is nothing in 155 (other than sub-categories) so it appears to display everything.

Could it be that I've not conveyed the category hierarchy clearly. The actual categories I want to either include or exclude are 156-160 (at the present time) which are sub-categories of 155.

I've just double checked, without the first '*,' category=155* displays nothing. BUT, if I exclude 'category=' then JUST use 155* as the filter, it works. In other words, including 'category=' influences the result.

TQ
Back to the top
 
Posted
Rating:
#112088
Avatar

Yes. I don't know where "category_id=" came from. You're entering a parameter name as a part of the filter parameter for reasons unknown.

I accidentally put in "category=" rather than repeating your "category_id=" when I replied, but that was a typo. I was assuming it really was a parameter named category_id (or category as per my typo), but that's totally wrong.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#112089
Avatar

Specific category:
155*

All but specific category:
*,155~
(you need to select everything then disinclude the category)

No prefixes like "category=" or whatever. You probably were looking at some broader piece of Comcode then assumed that part of the Comcode syntax was a part of the actual parameter value.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: