Best approach for adding splash page

Hi elggers,

currently I'm up for the task to make a splash page (The site i'm working for is currently in beta, the company wants to have a distinguished start page to let visitors know). I'm stuck at this moment, and I like to know you think is the best approach to do this.

On a site note: The splash page html doens't make use of the elgg framework. It just needs to look pretty with a button to redirect to the page they were going to.

I've found this gem, i've got to insert "<script type="text/javascript" src="splashpage.js">" at the HEAD of the page. My question is, were would this be?
I've already tried to insert in the index.php root file at the top.(I know, sorry, don't mess with the core files, just trying something out).

This works, but when returning the whole css is gone. Is it even possible?greatly appreciated

  • Splash pages don't exactly scream user-friendly to me. You may want to consider if there's another way of communicating the beta-ness of your app.

    That obligatory disclaimer aside, you can use elgg_register_js and elgg_load_js in your plugin's start.php to make this (or any) javascript load on every page.

  • Thanks for your response Evan. I am aware this isn't the most user-friendly way to go. However, we still consider it an option. Now I've tried setting up the plugin with this in the start.php

    function splash_init() {
        elgg_register_js ("splash", 'js/splashpage.js', $location= 'head', $priority=0);

    It won't work. Can you give me any direction what I'm doing wrong here? (pluginFolder = splash, manifest file + js/splashpage.js are there)

  • elgg_register_js URL must be relative to your elgg root, not your plugin root.

    And you must call elgg_load_js to actually load the js onto the page.

  • Out of curiosity, what is motivating you to seriously consider a known user-hostile design pattern?

  • Thank you Evan, Got the plugin working now.

    It is actually one of the options, we also think off and test other possibilities (like a section on home, or  a constant note in sidebar). In our team some people are pro and other against the splash-one-a-session page choise. So I thought if it isn't that hard to show them, so they could choose for themselfs. (thanks to you)

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking