I followed the this link for installing custom templates: http://www.mediafront.org/documentation/mediafront-osm-cms-integration/o...

After doing so, all of the associated pages where the template has been enabled on drupal return a 500 error when trying to access them via http. This includes the video page created, any page where the php script is added, the template edits itself and the Content Template.

In addtion to the edits to the file name changes and js files to replace "default" with "custom", here is my config and the error in my /etc/httpd/log/error_log file:

[root@brama custom]# rename default custom *

[root@brama custom]# ls
createIndex.bat jquery.media.template.api.js.js osmplayer_custom.css osmplayer_custom_menu.tpl.php osmplayer_custom_playlist.tpl.php osmplayer_custom_teaservoter.tpl.php template.php
createIndex.sh jquery.media.template.custom.compressed.js osmplayer_custom_hscrollbar.tpl.php osmplayer_custom_node.tpl.php osmplayer_custom_scrollbar.tpl.php osmplayer_custom_titlebar.tpl.php
images jquery.media.template.custom.js osmplayer_custom_ie.css osmplayer_custom_nodevoter.tpl.php osmplayer_custom_teaser.tpl.php osmplayer_custom.tpl.php
index.php osmplayer_custom_controlbar.tpl.php osmplayer_custom_links.tpl.php osmplayer_custom_pager.tpl.php osmplayer_custom_teaser.tpl.php.backup playlist.xml

[root@brama custom]# tail -20 /etc/httpd/logs/error_log | grep OSM
[Sun Jun 05 19:11:38 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88
[Sun Jun 05 19:11:40 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88
[Sun Jun 05 19:11:45 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88
[Sun Jun 05 19:24:59 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88, referer: http://www.vidconfig.com/admin/build/mediafront
[Sun Jun 05 19:25:58 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88, referer: http://www.vidconfig.com/admin/build/mediafront
[Sun Jun 05 19:27:00 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88, referer: http://www.vidconfig.com/admin/build/mediafront/preset/videopreset3/delete
[Sun Jun 05 19:27:00 2011] [error] [client 192.168.15.150] PHP Fatal error: Class 'CustomTemplate' not found in /var/www/html/ILLAG.DRUP6.20/sites/all/modules/mediafront/players/osmplayer/player/OSMPlayer.php on line 88, referer: http://www.vidconfig.com/admin/build/mediafront/preset/videopreset3/delete

[root@brama custom]#

After these errors, I am forced to delete the preset where the template was set and rebuild it. After I rebuild it using "default" as the template, everything works again.

Anyone have any ideas?

Comments

jviitamaki’s picture

Sub. Custom templates won't work in d7 either.

travist’s picture

Component: Miscellaneous » Documentation

Custom templates do work since I package them in with the download. If you download the latest DEV version, you will see two different custom templates... one called "simpleblack" and one called "shockblack".... Both of these work, so I know that custom templates work.

The issue here may have to do with documentation, so changing the component to documentation so that I can fix that. In the meantime, please just look at how I did those two templates to give you an idea how it works.

travist’s picture

Status: Active » Postponed
lvto2000’s picture

I will try it on Drupal 7. Thanks.

Here is a bit of information to share with other folks having this problem with Drupal 6.22. You have to change the class name inside the files too. Changing just the names (as the documentation states) of the files does not work leading to my error. The class name has a Capital letter in the file so if you grep for the small case then you will not find. (for some strange reason it would not find using any case for grep either). I got the error fixed now.

But, here is the real problem, I originally created my own preset to try to change the look and feel of the UI. However, simply changing the colors of the UI is not intuitive. I tried directly editiing the CSS files and there is some crazy auto CSS generator that dumps temporary css files in files/css. This overwrites unless you change permissions. If you do that then the program really gets screwy and adjusts my Homebox settings. There has to be an easier way edit simple functions as color and size of components.

smashtoe’s picture

I got my custom template to work in Drupal 7 by making additional changes to the template.php file.

As noted in #4, you have to rename the class from DefaultTemplate to CustomTemplate (if you named your custom template "foo", you'd name the class "FooTemplate").

BUT, you also have to change other references from in that file to your custom .js, .css files. In my case, I named my custom template "nnr". Look for "nnr" in the following fragment:

class NnrTemplate extends OSMTemplate {
  /**
   * Return's this templates settings.  This function is used to tell the Open Standard Media Player class
   * about your template.
   */
  public function getSettings() {
    return array(
      /**
       * Boolean variable to tell this template if you are using theme roller.  This will basically
       * generate new CSS files so that multiple themes on the same page will not collide with each
       * other.
       */
      'generateCSS' => TRUE,

      /**
       * The template specific JavaScript files required for this template.
       */
      'jsFiles' => array(

        /**
         * The release template JavaScript file(s).  Usually a compressed version of the debug version.
         */
        'release' => array(
          'templates/nnr/jquery.media.template.nnr.compressed.js'
        ),

        /**
         * The debug template JavaScript file(s) ( uncompressed ).
         */
        'debug' => array(
          'templates/nnr/jquery.media.template.nnr.js'
        )
      ),

      /**
       * The CSS files used for this template.
       */
      'cssFiles' => array(
        'theme' => $this->getThemeRollerCSS(),
        'template' => 'templates/nnr/osmplayer_nnr.css',
        'template_ie' => 'templates/nnr/osmplayer_nnr_ie.css'
      ),
...
travist’s picture

I also want to note that this functionality is getting MUCH easier with my current work on the 2.x branch. I am making it so that it does not require any PHP wrapper to build out a new template, and also there should not be any more crazy PHP code within the templates to bring in data. I am hoping that after I get that branch stable, it will dramatically reduce the overhead to get this working. Thanks for posting this, though!

Travis.

enjoylife’s picture

Title: Custom Templates do not work Drupal 6 » Custom Templates do not work
Version: 6.x-1.0-rc9 » 7.x-2.x-dev
mrtoner’s picture

Version: 7.x-2.x-dev » 7.x-1.5

Resetting version to 7.x-1.5, since this bug is specific to that branch. Custom templates are working in the 2.x branch.