We launched new forums in March 2019—
join us there
.
In a hurry for help with your website?
Get Help Now!
Back to MODX.com
Forums
Docs
Revo Issues
Blog
My Forums
Products
Revo Development
Search
get Category
12 Posts
weloper
Reply #1,
15 years, 2 months ago
(I hope, I chose the right subforum. If not, please move.)
My question: How do I retrieve the category of an instance of
modElement
?
4,149 Posts
splittingred
Reply #2,
15 years, 2 months ago
Either the ID:
$categoryId = $element->get('category');
Or the object:
$category = $element->getOne('Category');
shaun mccormick
| bigcommerce mgr of software engineering, former modx co-architect
|
github
|
splittingred.com
12 Posts
weloper
Reply #3,
15 years, 2 months ago
Ah OK, thank you.
It’s a bit difficult to find out via the API-docs as the inherited methods are not listed.