Creating custom template

OCS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, michael

Forum rules
The Public Knowledge Project Support Forum is moving to

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Posts: 3
Joined: Wed Apr 14, 2010 9:08 am

Creating custom template

Postby witzawitz » Wed Apr 14, 2010 9:29 am

Hi everyone!
I am trying to create (not modify) my own template in OCS. I know that OCS uses Smarty as template manager and I've tried several ways:

    1. Creating custom template in /templates/ folder using the same structure as in other tpls' folders. This didn't work because I think that it's not enough and requires of course some class structure and php coding.
    2. Creating php script and including neccessary libraries so that script calls template. But there is a problem with including file PhpQuickProfiler.php. I didn't find it in the whole OCS root directory. So the main script somehow uses it but I can't. This way didn't work either. Here is my code

    Code: Select all

        ini_set('include_path', ini_get('include_path') . ':' . '/var/www/<site dir>/lib/pkp/classes/:/var/www/<site dir>/classes/' );

        define ('DIR', dirname(__FILE__) . '/');
        define('INDEX_FILE_LOCATION', __FILE__);
        $t =& TemplateManager()::getManager();

    And I get error

    Code: Select all

    PHP Warning:  require_once(PhpQuickProfiler.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /var/www/<site dir>/lib/pkp/classes/core/ on line 17

    PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'PhpQuickProfiler.php' (include_path='...') in /var/www/<site dir>/lib/pkp/classes/core/ on line 17

    3. Of course I can create static html pages but in this case I can't use the sidebar with user status.

Could anyone please help me?

Posts: 4191
Joined: Tue Feb 14, 2006 10:50 am

Re: Creating custom template

Postby jmacgreg » Fri Apr 16, 2010 7:05 pm

Hi witzawitz,

Could you try to describe what you're trying to accomplish? There may be an easier way to do it than to create a new template (and as you've guessed, create a subset of php files behind it). For example, if you only need to create a few custom pages, you could always use the Static Page plugin (in OCS 2.3; under Conference Management -> System Plugins -> Generic; or otherwise available from the Plugin Gallery on this forum). You may also find the OJS Technical Reference handy in explaining how our software is designed.


Posts: 3
Joined: Wed Apr 14, 2010 9:08 am

Re: Creating custom template

Postby witzawitz » Sat Apr 17, 2010 4:16 am

Oh, thanks a lot.
I've tried to install it manually (but some error has occured) but it's already there I needed only to enable it.
It's what I need. Thanks again.

Return to “OCS Development”

Who is online

Users browsing this forum: No registered users and 1 guest