public
Description: JavaScript Application Framework - JS library only
Home | Edit | New

Changing your application’s title

If you don’t like the title of your application is just an URL such as ’’‘http://xxx.xxx.xx/static/example’’’, you can copy ’’‘index.rhtml’’’ from ’’‘default _src/lib/index.rhtml’’’ into your ’’‘clients/lib’’’ and change the “title” tag to whatever you like. For example, if you wanted to name your app “Hello World”, you’d do like this:

Step1: Copy ’’‘index.rhtml’’’ from ’’‘default _src/lib/index.rhtml’’’ into your ’’‘clients/lib’’’

mkdir clients/example/lib
cp default _src/lib/index.rhtml  clients/example/lib

Step2: Change the “title” tag to whatever you like.


<html>
   <head>
     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
     <title>Hello World</title>

or in code…

In function() main {} in main.js, place the following code:

document.title = 'Your document title goes here.';

Or in Ruby

The default index.rhtml template includes support for setting your page’s title from any other RHTML template. If you are using the default template (and not using the steps above), simply declare the following in any RHTML file in your client:

<% @title = "Page Title" %>

Subsequent definitions will override each other.

Comments

The ruby version does work, but it also performs processing on the text you enter. If I enter <% @title = "PageName Title" %> the resulting title tag contains Pagename title

Can anything be done about that?

Yep, you can edit the index.html template following the instructions in the first section above.

Last edited by sproutit, Wed Mar 04 09:21:57 -0800 2009
Home | Edit | New
Versions: