Hi,
We want to change the default homepage of our site to have a more customised “landing-page” look. then to have the default homepage that shows lists of journals as a link in the navigation menu, that is as a “child” of the new homepage. like so: Homepage > Journals.
please what’s the most ideal way to go about this? as we don’t want to start hacking around, making ugly .htaccess rules.
Without touching the Apache config, you could make your application a subdirectory under your root, e.g:
/index.html
/ojs/index.php
/ojs/config.inc.php
/ojs/…
This hits your requirements and is low maintenance, but comes at the cost of another layer in the URL.
By making a small change to your Apache config, you could set the default document with a prioritized DirectoryIndex to be a static page, and keep the application files in the same directory, e.g.:
My suggestions were assuming you wanted a static landing page outside of the OJS framework. If you want to leverage the framework to generate dymanic content outside of the existing options, you will need to do custom coding. preferably within the framework. Do you have someone with PHP experience?
I can point you in the right direction, but this is probably going to involve some pretty heavy lifting on your part.
OJS functions with a MVC framework. The site index is generated via this page call:
This references the template here:
To change the site index, your changes would be local modifications to these files. If you are going to make local modifications, I highly recommend version control, such as git or Subversion, to manage the locals.
we’ve given modifying the IndexHandler.inc.php file a shot, but it wasn’t successful.
We understand that the statements $templateMgr->display('index/journal.tpl') and $templateMgr->display('index/site.tpl'), are all loading ‘view’ files (like Laravel’s View::make('view') ), based on outcomes of the if ($journal) { statements. Also, that if ($site->getRedirect() && ($journal = $journalDao->getById($site->getRedirect())) != null) { $request->redirect($journal->getPath());} is a condition to redirect to a journal site, based on the value of ‘Journal redirect’ in ‘Site Settings’ (I think ).
We get all these, but our problem is in coming up with the condition to serve the user our ‘home.tpl’ file, where to implement it, and how to implement it to avoid messing up the rest of the code.
I’ll appreciate any further help to get this done.
In your situation, I would probably just modify the templates/index/site.tpl directly to include your new contents.
If you’re are going to include new bits of OJS data, you’ll need to assign these to template variables via $templateMgr->assign() calls in pages/index/IndexHandler.php for use in site.tpl.
ok, I’ll try that out, since I can use conditional statements to choose which blocks to display and which ones to not display.
If it gets too tricky though, I might eventually stick to your first suggestion (subdirectory), and change the index page dummy contents occasionally.
one last question: will there be any downsides to just using php to connect to & read the contents of the database myself?
also, if I put a search form in the navbar of this “index.html” file, can I submit this form to OJS?
@samice, the biggest downside to going directly to the database with a query is that then you need to keep track of the model relations and business logic (which someone else has already done for you within the framework).
The benefit to working within the framework is that not only do you leverage everyone else’s existing work, you have a good foundation to look at both the big picture of the system as well as many little components, and you are positioned to be able to contribute your work back to the broader community.