Setting up a 'Set As Startpage' link

From phpCMS

Jump to: navigation, search

If you want to include a link on your web pages to allow visitors to set the current page as the start page of their browser you can of course implement this using the JavaScript function that exists to that effect.
To simplify that task, you could add the following entry to your tag file:

<SETASSTARTPAGE> := <a href="#" title="set as start page" 
                    onClick="this.style.behavior='url(#default#homepage)';
                    this.setHomePage('URL');">Set as start page</a>

and use the tag <SETASSTARTPAGE> in your content file(s). If you want to have that link in your menu, you could achieve this by setting up an additional field JAVASCRIPT in your menu file and use that within the menu template.
The only thing not to forget is that you either have to change the default delimiter of the field separator (";") or additionally set up a tag in the tagfile as shown below.
Something like that:

home.mnu:

MENU: MAIN
CLASS; MNAME;              LINK;  TEXT;               JAVASCRIPT;
...
00.09; Set as start page;  #;     Set as start page;  <SETASSTARTPAGE>;

home.mtpl:

{MAIN.PRE}
<ul>
{MAIN.NORMAL}
<li><a href="{LINK}" {JAVASCRIPT} title="{TEXT}">{MNAME}</a></li>
{MAIN.AKTIV}
<li id="active"><a href="{LINK}" {JAVASCRIPT} title="{TEXT}">{MNAME}</a></li>
{MAIN.PAST}
</ul>

home.tag:

<SETASSTARTPAGE> := onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('URL');"

(Solution by joe in the thread 'Set As Startpage Link' in the phpCMS forum.)

Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage

Diese Seite in anderen Sprachen: Deutsch

Personal tools