It is often useful to “hard-code” the autonav block directly into your templates, so that the user doesn’t have to configure them and you can guarantee that they’ll always appear on every page of the site. Unfortunately, figuring out what the various options are and what they do can be very confusing. Below I’ve documented all of the available options, along with the corresponding explanations from the autonav block edit window.
As of Concrete version 5.5.2, it’s now really simple to include as many rich text editors as you’d like on a single block add/edit page or dashboard page:
1: Include this one time (regardless of how many rich text editors you have) at the top of the file:
2: Include these two lines in each place you want a rich text editor:
That’s it – nice and simple! Note that the
Here is a sample
edit.php file from an imaginary block that has two fields for content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
I’ve updated Designer Content in the marketplace to version 3.1, which now includes this functionality. It also makes the generated code simpler, which is a major bonus!
Bonus for astute readers: You may be wondering how the “editor_controls” element (the blue Concrete5 bar that sits above the normal TinyMCE controls) knows which text area to attach itself to… Turns out it doesn’t! The Concrete5 bar will insert images, files, and links into the text editor that currently has the focus (or the last one to have the focus if neither of them has the focus currently). Usually this isn’t an issue because people tend to insert images and links when they’re typing into a specific editor field, so the field they’re typing into will by definition already have the focus. But I can see how this might cause occasional confusion… not a huge deal but something to be aware of.
I did see something in the code that looks like it lets you specify an “id” to apply controls to, but I haven’t had the time or motivation to investigate further. If anyone has any ideas about this, please leave them in the comments.
UPDATE: Concrete220.127.116.11 fixes the issue mentioned below – if you’re running Concrete5.5.2, you should just upgrade to 18.104.22.168 to fix this problem (and several other bugs).
A rather nasty bug was introduced in Concrete 5.5.2 that affects many image gallery addons (Simple Image Gallery, Sortable Fancybox Gallery, Deluxe Image Gallery, etc.) as well as the File Manager’s “File Sets” page.
The error looks like this:
Fatal error: func_get_args(): Can't be used as a function parameter in [...]/updates/concrete5.5.2/concrete/libraries/item_list.php on line 515
(or it may look like this, if your site started out with 5.5.2 as opposed to being upgraded):
Fatal error: func_get_args(): Can't be used as a function parameter in [...]/concrete/libraries/item_list.php on line 515
It appears that this bug will be addressed in the next release of the system, but who knows when that will happen. In the meantime, you can fix this on your site by making a small modification to the file mentioned in the error message (look for
SITEROOT/updates/concrete5.5.2/concrete/libraries/item_list.php first, but if that file doesn’t exist then look for
Find this line of code (should be around line #515):
$this->sortByString = implode(', ', func_get_args());
…and replace that 1 line with these 2 lines:
$args = func_get_args(); $this->sortByString = implode(', ', $args);
As soon as you save that file, your image galleries and file manager should immediately start working again.
Creating your own attribute types in Concrete5 can be very confusing because there are a TON of things you can do with them. If you look through the code for the built-in attribute types (in the
SITEROOT/concrete/models/attribute/types/ directory), it is hard to figure out what is essential versus what is specific to each attribute type’s custom functionality.
I’ve had to create a few custom attribute types recently, and in the process of doing so I pared down the code to the bare essentials. I’ve posted this sample code on my github repo: https://github.com/jordanlev/c5_minimal_attribute_type
Hope this helps!
If you need to build an image gallery or slideshow for a Concrete5 site, I’ve made some boilerplate code available that handles all of the editing and database infrastructure so you can concentrate on implementing the front-end (usually a jquery image gallery or slideshow plugin). The code is available here:
Read on for details and instructions on how to use it, using the Flex Slider as an example…
I came across this great blog post today about some simple techniques that can optimize performance of your jquery code:
It’s very straightforward and well-written. Nothing specific to Concrete5, but certainly useful to know.
A project I worked on recently required that users upload a file when they register for the site. I thought the built-in “Image/File” attribute type would be able to handle this, but I was wrong. The problem is that it only provides a File Manager selector, not an actual HTML file input tag. Even if I wanted to let the general public see the File Manager (which I don’t), it wouldn’t work because these are unregistered people who don’t have access to the File Manager anyway.
So I created my own attribute type for this, and am sharing it here.
Read on for installation instructions, usage details, and caveats/limitations…
The built-in Autonav block is one of the most essential blocks in a Concrete5 site (right up there with Content and Page List). But if you’ve already designed a menu with a certain HTML and CSS structure, it can be very difficult to modify the autonav template to suit your needs because its default template is rather messy.
For example, what if you want to change the name of the class that indicates the current page from the default “nav-selected” to the more succinct “active”, or “current” (something that is used frequently in other systems’ dropdown menus)? Or what if you want to add a new class denoting the first or last item in the list? Or what if you want to do something more drastic like change the unordered list structure to a series of divs and spans? I consider myself a decent programmer and even I would be afraid of messing with that code!
But after a year of struggling with the autonav template on dozens of sites, and a healthy dose of assistance from other members of the C5 community, I’ve finally gotten it all figured out and have re-constructed the template so it is cleaner and easier to customize. Behold!
Not only is the markup nice and clean, but this template includes a ton of additional features beyond what the built-in autonav template provides (although it doesn’t break backwards compatibility in any way – you can use this new template unmodified and your site’s markup will not be any different than it was before). Some of the additional features available to you are:
- Ability to easily set and change class names for a variety of different circumstances (e.g. first and last items, item contains dropdown, unique class for every single item, etc.)
- Fixes a Concrete5 bug that resulted in all child pages of an excluded page to be included in the menu (the same functionality included in the Autonav Exclude Subpages addon)
- Recognizes a new custom attribute (
exclude_subpages_from_nav) you can add to your site that lets you exclude all of a page’s children without excluding that page itself
- Lets you set up a custom attribute (
nav_item_class) for a custom class name – whatever text is entered into that attribute for a certain page will get outputted into the menu item’s list of classes