Let me explain visually:
This is the file view: http://www.mojdizajn.net/file/view/9982/sta-mislite-o-ovome
And this is the DOWNLOAD view: http://www.mojdizajn.net/file/download/9982
I want to edit the second one. To wrap some html around it, and put "back to the site" link...
So, where should I put this html code?
It probably should be in elgg\mod\file\pages\file\download.php, but I've tried everything, and couldn't do nothing.
DOWNLOAD view: http://www.mojdizajn.net/file/download/9982
It's a result of the downloading action.
See in elgg\mod\file\pages\file\download.php
And...
Remember, don't modify core
@srokap - I've used both methods, but I have an issue with the elgg_load_* functions in views when using ajax. Have you done anything with those kind of situations?
Personally I like having the contextual body class anyway. Though it's extremely easy to do in a theme, a designer shouldn't need to expect it in core.
@Matt Beckett: Fellow developper is working on sth like that, but it's 2 layer system much different from typical Elgg install. In general, content pulled via AJAX contains additional info about CSS/JS dependencies that are then processed and dynamically loaded if not already present. It's especially problematic when it comes to JS code.
If we talk about AJAX retrieving bare HTML (assuming core /ajax/ page handler) I would try sth like:
* detect if elgg_is_xhr
* while rendering top view attach piece of code to the output (JS or sth to be postprocessed on cliend side) determining dependencies
* load missing assets dynamically
It should be rather easy for CSS only.
In general building some basic client side JS framework for AJAX content refreshing is a good idea and allow more elegant implementation of passing additional information, which quickly becomes necessary.
See also http://trac.elgg.org/ticket/4830
In general I agree that registering CSS files as needed is better, but the body classes added automatically in WP/Moodle2 can be really helpful in a pinch. I've got plugin code to do both alter the class and set names based on the URL ill try to release soon.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.