Use of JavaScript or CSS

From phpCMS

Jump to: navigation, search

[edit] JavaScript or CSS in phpCMS templates / content files

In its default setting, phpCMS uses curly brackets "{" and "}" as a field delimiter. If you use JavaScript or CSS inside a template or a content page, and that contains curly brackets, phpCMS takes that for a phpCMS field. To solve this, you have three possibilities:

  1. In the configuration GUI you define a different field delimiter.
    • Disadvantage: This change is valid for the whole of the web space.
  2. You use external .js or .css files.
    • Disadvantage: Inside the JavaScript or CSS definitions you cannot use phpCMS tags.
  3. You define a replacement tag for the curly brackets.
    • The most versatile possibility.

To implement possibility no. 3 above, you insert the following into your home.tag:

<(> := {
<)> := }

where "<(>" stands for the opening curly bracket, and "<)>" for the closing one.
In your templates or content files you then use "<(>" and "<)>" instead of "{" and "}" in your JavaScript or CSS parts, e.g.

<SCRIPT LANGUAGE="JAVASCRIPT">
 <!--//
  function Alarm (Message) <(>
     alert (Message);
  <)>
 //->
 </SCRIPT>

External .js .css files can use the curly brackets as usual.

Diese Seite in anderen Sprachen: Deutsch

Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage

Personal tools