Extension:Cargo/Common problems

From MediaWiki.org
Jump to navigation Jump to search
Cargo - navigation
Basics Main page (talk) · Download and installation · Quick start guide · Other documentation · SMW migration guide
Using Cargo Storing data · Querying data (Display formats ) · Browsing data · Exporting data · Other features
Resources for help Common problems · Known bugs and planned features · Getting support
About Cargo Authors and credits · Version history · Sites that use Cargo · Cargo and Semantic MediaWiki · FAQ
  • If you see an error message that looks like "A database query error has occurred. This may indicate a bug in the software.", you should add the following to LocalSettings.php, so that the page displays a more helpful error message:
$wgShowSQLErrors = true;
  • Similarly, if you see an error message like "Fatal exception of type MWException", add the following to LocalSettings.php for a more helpful error message:
$wgShowExceptionDetails = true;
  • Cargo makes use of the MediaWiki API, so make sure that you do not have the API disabled; if you have $wgEnableAPI set to false in LocalSettings.php, you should remove that line.
  • If the "where" clause contains something like "_pageName = '{{PAGENAME}}'", the query will break for pages that contain a single quote/apostrophe (') in their name. There are a few potential fixes for this: the easiest is to change the query to "_pageID = {{PAGEID}}", which should always work. Another option is to change it to "_pageName='{{#replace:{{PAGENAME}}|'|\'}}'". (You could also consider replacing the single quotes around {{PAGENAME}} with double quotes, but single quotes are generally preferred for SQL literals, plus this formulation will itself break if the page name contains double quotes.)
  • By default, '=' comparisons in MySQL are case-insensitive. If you want an '=' comparison within the "where" clause to be case-sensitive, you can do it by adding "BINARY" to the comparison, like "BINARY Nickname = 'Joe'". You can do the same thing for "HOLDS" statements, like "BINARY Genre HOLDS 'Drama'".
  • Unlike Semantic MediaWiki, Cargo does not provide a "class" parameter for any of its formats. However, you can still define custom formatting for a display, by wrapping a #cargo_query call inside a "div" or "span" tag that has its own class declaration, like <div class="black">{{#cargo_query|...</div>. Then the CSS you use can contain calls like "div.black table ...", or whatever it is.
  • If you have the Joomla! CMS running on the same server as MediaWiki, it may lead to the Cargo "recreate data" action failing. That is because one of Joomla's recommended htaccess settings blocks the string "template" in the URL, and Cargo uses this word as a parameter in its API call. To get Cargo working, you will probably have to modify or remove this line.
  • If you want to show a row number for each row in the query results, the easiest approach is to use the "template" format, and use the NumerAlpha extension - specifically the #counter parser function - within the template.