Personal tools
You are here: Home Documentation How To's How to Add a Splash Page to your Site

How to Add a Splash Page to your Site

by T. Kim Nguyen last modified Aug 25, 2008 02:20 PM

without having to install a product or restart the Plone/Zope server

Here's one way to make a splash page that does not require installing a product. I tried this with Plone 3.1 but it'll probably work with Plone 3.0 too.

 

Upload the Splash Image


First, upload to the Plone site the image you want to have appear as the splash. Call it splash.jpg. You can put it anywhere on the site, though it is probably best in portal_skins/custom.

Create a Page Template for the Splash Page


Then in the root of the Plone site, via the ZMI, add a DTML Document and call it "splash". Put the following HTML in it and save it:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Though this be madness yet there is method in it.</title>
<style type="text/css">
body {
 background:black;
}
img {
 border:none;
}
</style>
</head>
<body>

<a href="front-page"><img alt="Click to see the web site" src="splash.jpg"></a>

</body>
</html>

In this case, I decided to make the background of the splash all black. When someone clicks on the splash image it takes them in this case to the page with ID "front-page", which all Plone sites have by default when they're created.

I explicitly set images to have no border because IE6 and Firefox (2 and 3) add a blue border around links by default.

Make a Default Page for the Site


You can't use Plone's root folder "select item to display" to choose this new splash page because the new splash page is a Zope object, not a Plone object, and so Plone does not see it (and therefore you can't choose it from the list that Plone shows you).

So, also in the root of the Plone site, via the ZMI, add another DTML Document called "index_html". Put the following HTML in it and save it:

<dtml-let target="'http://127.0.0.1:10080/Plone/splash'">
<dtml-call expr="RESPONSE.redirect(target)">
</dtml-let>


The first line requires you to place the full URL of the "splash" DTML document we just created above. I haven't figured out yet how to avoid having to put the full URL in.

See the Splash Page Just Once

If you left the site as it is now, whenever anyone went to your Plone site at http://127.0.0.1:10080/Plone they would be shown the splash image, and they could click on it to get to your site's "front-page" document. However, whenever they clicked on a Home link they would be taken to the splash image again, and you probably don't want that (it'd be annoying).

There are two ways other than the one I describe here to prevent a visitor from seeing the splash page every time he/she goes to the site URL:

  • set and look for a cookie using a script that is always run on the home page; the cookie indicates that the visitor has seen the splash; on subsequent visits to the home page, the script looks for the cookie and if it sees it and the cookie value says the visitor has seen the splash, don't show the splash; this is probably doable without restarting the server
  • install the OpenPlansOrg product that redirects the request to the splash page using the same cookie idea; see https://svn.openplans.org/svn/OpenPlansOrg/, but this requires a product install and server restart

Four Things to Customize

Here is my method: you must change all the Home links to point instead to "front-page". There are four places to do this.

  • tabs: in ZMI, go to portal_actions/portal_tabs, change the URL for "index_html" by appending "/front-page" to it so it should end up like
  • string:${globals_view/navigationRootUrl}/front-page
  • logo: in ZMI, go to portal_view_customizations, customize plone.logo, changing the string
    tal:attributes="href view/navigation_root_url"
    to
    tal:attributes="href string:${view/navigation_root_url}/front-page"
  • breadcrumbs: in ZMI, portal_view_customizations, customize 'plone.path_bar', and change the line
    <a i18n:translate="tabs_home" tal:attributes="href view/navigation_root_url">Home</a>
    to
    <a i18n:translate="tabs_home" tal:attributes="href string:${view/navigation_root_url}/front-page">Home</a>
  • navigation portlet: in ZMI, portal_view_customizations, customize 'navigation.pt', and change line 26 from 
    <a tal:attributes="href root/absolute_url;
    to
    <a tal:attributes="href string:${root/absolute_url}/front-page;

 

Document Actions
  • Print this
  • Bookmarks