CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Navigation Menu url format for menu hook
Pages: [1]

Author Topic: Navigation Menu url format for menu hook  (Read 483 times)

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Navigation Menu url format for menu hook
March 12, 2014, 07:56:17 am
I noticed that a lot of the core navigation menu entries in the civicrm_navigation table start the query string with an ampersand rather than with a question mark. For example in recent installs of civicrm I have found the following entries: "civicrm/admin/contribute/add&reset=1&action=add" and "civicrm/contact/add&reset=1&ct=Individual".

I was wondering why the query string starts with an ampersand and if it is a convention that extension developers should follow? If so I will document it on the page for the navigation menu hook.
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Navigation Menu url format for menu hook
March 12, 2014, 07:58:23 am
I noticed that too. It seems to be the convention but I'm not sure why. Have you found any examples that use a question mark?
Try asking your question on the new CiviCRM help site.

lolas

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
    • Freeform Solutions
  • CiviCRM version: Several
  • CMS version: Drupal
  • MySQL version: 5.1+
  • PHP version: Several
Re: Navigation Menu url format for menu hook
March 12, 2014, 08:12:32 am
Yes running the sql below gives about 11 results (out of 246) including "civicrm/admin/pcp?reset=1&page_type=contribute", "civicrm/financial/financialbatches?reset=1&batchStatus=1" and a few others.

Code: [Select]
SELECT * FROM `civicrm_navigation`
WHERE url like '%?%'
Freeform Solutions provides technology and management consulting, website and database development, and managed internet hosting solutions for not-for-profit organizations (NFPs).

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Navigation Menu url format for menu hook
March 12, 2014, 04:20:58 pm
Don't have the answer, but another clue: "Clean URLs" are a sort of optional sugar-coating which rewrite the inputted URL ("/civicrm/foo?bar=baz") to a different URL ("/index.php?q=civicrm/foo&bar=baz"). In some configurations (like some Drupal sites and most/all WP & Joomla sites), we don't use "Clean URLs".

There are multiple ways to format the concrete URL based on runtime configuration, but it makes sense to have one canonical format for storage in the DB. Maybe there's logic which converts "civicrm/foo&bar=baz" into the clean or unclean notation (based on the config)?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Navigation Menu url format for menu hook

This forum was archived on 2017-11-26.