2

I am new to Craft and I am trying to figure out how routing works. When I click on an entries nav item, it makes a request to:

.com/index.php?p=admin/actions/elementIndex/getElements

The url of the item is .com/entries/affiliates and the call is ajax.

There is a section called affiliates, but the 'template' field is Null. I can't seem to figure out where the response is coming from.

2

There is an overview of how routing works in Craft here: https://craftcms.com/docs/routing and that guide works for front-end routing as well as Craft's own control panel routing when deciding which (if any) templates to render.

The call to p=admin/actions/elementIndex/getElements is a control panel AJAX action request (#3 is the routing list) that's going to the craft/app/controllers/ElementIndexController.php's actionGetElements method and returning data.

1
  • Hey Brad, thanks for your help! I figured this part out, but where I am still confused is is the _getElementHtml function which renders the Html that is sent as the response. From where does it get the HTML, how does it know which template to use as it is very generic and used by many cp views? Thanks! – user2997606 Jul 6 '16 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.