Collection::getByHandle($c); reason why on part of the code
Permalink
Good Day Everyone,
I there anyone who could give me an answer to the following question?
Below there is a piece of code straight from the models/collection.php file. It says What is the reason of the last check $row['pcID'] == null. Why do we want to make sure it's empty? What does it matter if the pcID also exists? If yes, what are those limitations or problems I'll run into eventually. I realy can't think of any, but modifications im doing to the core script require me to be able to get a collection by its handle when also the page exists.
Thanks in advance.
Full part from line 657 v.5.5.2.1 models/collection.php:
I there anyone who could give me an answer to the following question?
Below there is a piece of code straight from the models/collection.php file. It says
"if ($row['cID'] > 0) { //&& $row['pcID'] == null) {"
Thanks in advance.
Full part from line 657 v.5.5.2.1 models/collection.php:
} else { $row = $r->fetchRow(); if ($row['cID'] > 0) && $row['pcID'] == null) { // there is a collection, but it is not a page. so we grab it $cObj = Collection::getByID($row['cID']); } }
Thanks for your quick response. I've used the function within the Page model getByPath, just like you mentioned.
I actually thought that Pages and Collections were the same, that's why I didn't understood why it was scripted like that. Although I would still like to see an example (by the devs probably) which makes it clear that Pages are different from Collections.
Thanks for now.
I actually thought that Pages and Collections were the same, that's why I didn't understood why it was scripted like that. Although I would still like to see an example (by the devs probably) which makes it clear that Pages are different from Collections.
Thanks for now.
You and me both :)
All that being said, I think you're looking in the wrong place. What you probably want to be calling is Page::getByPath (not Collection::getByHandle). I searched the codebase for calls to Collection::getByHandle, and couldn't find any, so I'm guessing that method is deprecated (and unfortunately not documented as such -- tsk tsk).
If you care to explain what it is you're trying to achieve, someone might be able to give you a better answer. If not though, then I'd just steer clear of the Collection model entirely and stick to the Page model.