How can I generate an internal URL to a CiviCRM page based on certain parameters?
In PHP

CRM_Utils_System::url('civicrm/contact/view', "reset=1&amp;cid=$contactID")


See code-level docs for CRM_Utils_System::url for more details.

In Smarty

{crmURL p='civicrm/contact/view' q="reset=1&amp;cid=`$contactID`"}


See code-level docs for CRM_Utils_System::url for more details.

In Javascript

CRM.url('civicrm/contact/view', {"reset": 1, "cid": contactID});


See code-level docs in civicrm/js/crm.ajax.js for CRM.url for more details.

This content was migrated here from the Cheatsheet wiki page as part of the 2017 wiki content migration project.