Problem Solving

Is my favourite programming language supported?

The list of languages supported by Syntax Anywhere is absolutely enormous.

If your required programming language is not supported by one syntax processor, have a look through some of the other syntax processors and you will almost certainly find it in one of them. That is one of the reasons why Syntax Anywhere is pluggable and provides so much choice.

Some syntax processors can detect a language automatically. With other syntax processors you may need to provide a hint by adding a language="language_name" attribute to the containing element.

If If you can't find a suitable syntax for your language, try a language with similar syntax.

Can I find a highlighting theme that works with my site

As with language syntaxes, Syntax Anywhere provides a massive choice of highlighting themes across the different syntax processors. The examples listed on these pages are just a tiny subset of those available.

Within Syntax Anywhere the available highlighting themes are generally identified automatically from manifests provided by  CDN sources or by parsing directory listings. Some highlighting themes look better than others for some languages. 

If in doubt, start with or go back to the default theme for your selected syntax processor. This will give you confidence that the syntax processor and language are highlighting correctly.

Then look for a highlighting theme that both works well with your Concrete CMS site theme and looks good for the languages you are working with. 

My code is not being syntax highlighted

The default settings of Syntax Anywhere are great for cutting and pasting code fragments into Atomik or Elemental and closely related Concrete CMS themes. But sometimes its a little bit more tricky than that. If you are getting no syntax processing at all, or syntax processing is not formatting correctly, here are a few things to check and try.

Diagnostics

As a confidence builder, you can try a couple of really simple syntax processors. The Plain Lines processor does just that. The Diagnostic processor will return what Syntax Anywhere is selecting from the page and show it so you can double check what is actually being processed. 

For developers, there is also a setting on the Advanced tab to output JavaScript diagnostics to the developer console, though that is mainly for my benefit if things are really getting tricky. 

Overall Container selector

In the Selection tab, check the Overall Container selector. This needs to select an element that wraps content in your theme. If in doubt, open the developer console on the Main area of a page and look outwards for the overall wrapping elements and their classes.

<pre> and <code> elements

Where sections of code are wrapped in <pre> and <code> elements, sometimes the theme formatting for these elements overrides the syntax. On the Tag Correction tab, you can check to remove surrounding <pre> or <code> elements, so freeing Syntax Anywhere and the various syntax processors to do their thing. 

As an alternative, you can also use [code].....[/code] markers to wrap your code fragments.

But there are things I don't want highlighted...

You can exclude sections by CSS selector in the block dialogue. Or if you need to be extremely specific, you can add the class syntax-anywhere-exclude to any element and Syntax Anywhere will ignore it and any of its child elements.

Missing Class errors during install

In addition to their internal functionality, many of my addons make use of facilities provided in others to enhance their own capabilities. The consequence is that occasionally an update to an addon will depend, where another of my addons is installed, on an update to the other addon. 

Hence:

Before installing, please endure existing installed addons are updated.

Javascript in another addon doesn't respond correctly when Syntax Anywhere is active on the page

The main way Syntax Anywhere can mess with JavaScript in another block is when you use the [code]...[/code] method of specifying syntax areas. Behind the scenes, Syntax Anywhere does some rewriting of the html to facilitate [code] sections, and doing so can result in other JavaScript event handlers becoming detached.

The simple solution is to not configure Syntax Anywhere to look for [code]..[/code] on any page containing JavaScript heavy blocks. Use any of the other methods of declaring sections to be highlighted such as <pre class="syntax_anywhere">...</pre>.

You can see Syntax Anywhere working on the same page as blocks that involve quite complex JavaScript on this site.

You can also exclude a block from any consideration by Syntax Anywhere by wrapping it with the class "syntax-anywhere-exclude" or specifying an id or class for the block in the Exclude section of thye Syntax Anywhere edit dialog.

Whoops on install

What we mean here is an internal code exception in an addon or the core when you click the install button from the Add Functionality dashboard page or when you visit a page after installing an addon package. 

If you experience such an issue, here are a few things you can check that may resolve the problem.

  1. Php Version. Check your php version is compatible with the addon, For example, check if you are running php5.6 when an addon requires php7+. You can find the php version in the report at /dashboard/system/environment/info. As a general guide, if your site is ConcreteCMS version 8+ then aim to run on at least php7.2. (It will run on lower versions, but less efficiently)
  2. Database Entities. ConcreteCMS uses a database abstraction layer called Doctrine. Doctrine works by creating proxy classes that map between php data and the database and sometimes these get out of step or muddled into a chicken and egg dilemma. The dashboard page at /dashboard/system/environment/entities has a switch to control when the proxy classes are regenerated. Try placing this into Development mode when installing an addon package (but remember to disable development mode to speed up a live site)
  3. Cache. ConcreteCMS makes extensive use of a number of different caching mechanisms to speed up web pages. When installing a package, sometimes outdated cached data causes issues with the install. Try disabling all the caches at /dashboard/system/optimization/cache when installing an addon package (but remember to re-enable the caches for a live site).
  4. Theme. Most marketplace themes are well behaved. Nevertheless, sometimes a theme can interfere with an addon package, so try switching the site theme back to Atomik using /dashboard/pages/themes. You won't loose any content on the front of your site, but some page areas may not be shown until you swap back to your theme.
  5. Middleware. Some addons implement middleware layers that manipulate pages before and/or after the main rendering of each page. If such addons are installed, there is a possibly they could interfere with the dashboard and other addon installation. Most such middleware implementations include condition checks to ensure they don't mess with the dashboard, but perhaps you can switch them temporarily off just to be sure.

If you experience a code error on or immediately after install and need assistance, please use the Get Help link from the addon marketplace page to report the problem. On the Whoops report, click the [copy] button immediately below the error message. That will provide a stack trace you can paste into the help request and save time having to request that report later.

Cache path exceeds...

A windows system can throw an exception about cache path length. The full message will be something like "Cache path exceeds Windows PHP MAX_LENGTH of 260 characters" and the name of the exception is WindowsPathMaxLengthException.

This arises as a combination of ConcreteCMS and php internal issues. From JtFResources v2.19.32 we have a work-round for this by introducing the configuration value max_key_length in the file application/config/generated_overrides/jtf_resources.php. On windows, this will be automatically set to a value suitable for most windows installations.

If you experience the above exception:

  1. Check the version of JtFResources is v2.19.32. If not, update this addon.
  2. Check the value of max_key_length. It may not be configured for your installation if it has been copied from another site.
  3. Reduce the value of max_key_length until you cease experiencing the WindowsPathMaxLengthException.

In general, keep the value of max_key_length as high as practical for your installation. The ConcreteCMS core applies a hashing algorithm to all cache keys and a longer value for max_key_length reduces the (already extremely small) probability of cache key collisions.

Manually Installing or Updating an Addon or Theme

Perhaps you are unable to connect your site directly to the ConcreteCMS marketplace to install an addon or theme. This manual process works for all addons and themes - not just mine.

  1. In your concrete account, find the addon/theme in your Purchase History > Licenses and download. Make sure to scroll down to the most recent version before downloading.
  2. Then copy the zip to your site /packages/ directory and unzip (not /concrete/packages !!!). This is usually easiest using your host cPanel file manager.
  3. In your site, visit the Dashboard > Extend page and the theme package will be ready to install or update

The process is exactly the same for addons and themes, except themes have an extra step of activating the theme after installing.

Sometimes step 3 above can run out of PHP execution time. This is most likely when installing an addon or theme that installs a large amount of sample content. You should not run into such an issue with any of my addons or themes.

If you do run into such issues, you can run the install manually from the shell command line.

$ concrete/bin/concrete5 c5:package-install my_package_handle

or

$ concrete/bin/concrete5 c5:package-update my_package_handle

When updating, be sure to replace the previously installed package directory rather than adding to it. If not, you could end up accumulating obsolete debris from a previous version of the package.

If you find yourself needing to install or update many addons or themes manually, consider my Package Magic addon.

Once Package Magic Starter is installed, through the marketplace or manually, all further installs can be handled from the site dashboard using Package Magic.

Easy Setup

  1. On this site find an example similar to what you require, click the View settings button, copy the settings JSON.
  2. On your page, add a block. On the Support tab click the button to Import settings, paste the settings JSON and import,
  3. Edit the settings to what you require.