Title: Error loading MVC templates
Last modified: August 21, 2016

---

# Error loading MVC templates

 *  [Bakke](https://wordpress.org/support/users/bakke/)
 * (@bakke)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-loading-mvc-templates/)
 * Hi,
 * [giving WordPress its own directory](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
   will break this plugin.
 * I have my content directory set to _/content_, while WordPress i located in _/
   wordpress_. This will give errors in admin like:
 * `/wordpress/content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/
   nextgen_addgallery_page/templates/upload_images.php is not a valid MVC template`
 * This is because the plugin is using ABSPATH to locate template files, instead
   of plugin_dir_path() (ABSPATH is for loading WordPress files). The method _find\
   _template\_abspath()_ in _Mixin\_Mvc\_View\_Instance\_Methods_, will not be able
   to locate template files, because _$\_document\_root_ is wrong!
 * The use of ABSPATH to locate plugin files should be completely removed.
 * [https://wordpress.org/plugins/nextgen-gallery/](https://wordpress.org/plugins/nextgen-gallery/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Contributor [photocrati](https://wordpress.org/support/users/photocrati/)
 * (@photocrati)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-loading-mvc-templates/#post-4643372)
 * [@bakke](https://wordpress.org/support/users/bakke/) – Have you tried our latest
   beta version? See this page for more details: [http://www.nextgen-gallery.com/nextgen-gallery-latest-beta/](http://www.nextgen-gallery.com/nextgen-gallery-latest-beta/)
 * – Cais.
 *  Thread Starter [Bakke](https://wordpress.org/support/users/bakke/)
 * (@bakke)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-loading-mvc-templates/#post-4643449)
 * Yes, I have tried 2.0.55, as well as the “stable” 2.0.40.
 * [giving WordPress its own directory](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory)
   is not supported at all. This is due to wrong use of the ABSPATH constant (this
   is used to determine the document root in the plugin, while it actually gives
   you the location of WordPress, which is not always document root).
 * My WordPress-installation is setup like this:
    _/path/to/page/wordpress/_ – Standard
   WordPress-installation. No themes or plugins live here. _/path/to/site/content/_–
   This is where i keep my themes, plugins and uploads. Just as described [here](https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory).
 * NextGen Gallery will go looking for files inside _/path/to/page/wordpress/_ –
   because it uses ABSPATH. While it should be looking inside _/path/to/site/content/_.
 * Instead of using ABSPATH as a base for finding files, you should be using constants
   like WP_CONTENT_DIR, WP_PLUGINS_DIR and functions like _plugin\_dir\_path()_.
   That is the correct way, and would solve this problem.
 * Giving WordPress its own directory is becoming more and more popular, and is 
   considered a _best practice_ by many. Supporting this should be a priority.
 *  [sebastien.barre](https://wordpress.org/support/users/sebastienbarre/)
 * (@sebastienbarre)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-loading-mvc-templates/#post-4643519)
 * Same here, my WordPress has its own dir, I’m getting the same errors.
    Did you
   find a workaround?
 * More specifically, my install is:
 *     ```
       wp-testing/wordpress
       wp-testing/wp-content/plugins/nextgen-gallery
       ```
   
 * where wp-testing/wp-config.php starts with:
 *     ```
       define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']);
       define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');
       define('WP_CONTENT_DIR', realpath($_SERVER['DOCUMENT_ROOT'] . '/wp-content'));
       define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content');
       ```
   
 * Editing nextgen-gallery/products/photocrati_nextgen/modules/fs/class.fs.php fixes
   the MVC error:
 *     ```
       class C_Fs extends C_Component {
       [...]
       	function initialize()
       	{
       		parent::initialize();
       		$this->_document_root = $this->set_document_root(WP_CONTENT_DIR);
       	}
       ```
   
 * but the path to all internal NextGen CSS/JS files is still incorrect, so there
   must be another location in NextGen where the plugin path is not computed from
   the WordPress constants. Actually it seems that ABSPATH is used in many many 
   files, so this is going to be tricky 🙁

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Error loading MVC templates’ is closed to new replies.

 * ![](https://ps.w.org/nextgen-gallery/assets/icon-256x256.png?rev=2083961)
 * [Photo Gallery, Sliders, Proofing and Themes - NextGEN Gallery](https://wordpress.org/plugins/nextgen-gallery/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/nextgen-gallery/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/nextgen-gallery/)
 * [Active Topics](https://wordpress.org/support/plugin/nextgen-gallery/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nextgen-gallery/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nextgen-gallery/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [sebastien.barre](https://wordpress.org/support/users/sebastienbarre/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/error-loading-mvc-templates/#post-4643519)
 * Status: not resolved