cotonti.com : Local header code https://www.cotonti.com Последние сообщения в теме Cotonti en Sat, 19 Sep 2026 10:31:17 -0000 foxhound Well, that means you just have to look into the php files to find a variable, right?
You could even use variables which are introduced with plugins.
So, if you need something open the php files and have a look at it. I guess even a noob like me can do that ;-)


Argh, it redirected me to the wrong topic after login. Sorry.]]>
пн, 06 дек 2010 20:54:43 -0000
Kingsley сб, 04 дек 2010 00:24:26 -0000 Hodges http://stackoverflow.com/questions/196702/where-to-place-javascript-in-a-html-file

Specifically:
Also, the reason why Yahoo EPT recommends placing JS at the bottom is because the browser must go into single-threaded mode while the JS loads and then executes. If the script is in the head or in the midst of the content, the browser will "pause" while it deals with the JS. By placing the JS at the bottom, the content will be loaded and generally visible so the user can start reading it while the browser is still dealing with the JS.
]]>
пт, 03 дек 2010 22:52:51 -0000
Kingsley # Koradhil : Also you normally shouldn't put javascript in the header, but in the footer (just before </body>).

why is that?]]>
пт, 03 дек 2010 22:43:23 -0000
Hodges
In the end I went with Koradhil's code in the page body. Works a treat.

Damn I really should learn how to use jquery now :P]]>
пт, 03 дек 2010 22:37:13 -0000
pieter # ez : The tags are pretty easy to find in the php files, but you are right a list should be nice..
There are some here: http://www.cotonti.com/plug.php?e=tpltags

Some explanation next to it, would be nice]]>
пт, 03 дек 2010 04:58:32 -0000
ez
So just put your js in your page !


@Pieter:
The tags are pretty easy to find in the php files, but you are right a list should be nice..
There are some here: http://www.cotonti.com/plug.php?e=tpltags]]>
пт, 03 дек 2010 03:25:36 -0000
pieter Suggestion for documentation:
List of most used tags
{PAGE_ID}
{PHP.al}
....
There are so many that nobody knows them all. Execpt programmers.]]>
пт, 03 дек 2010 03:08:22 -0000
GHengeveld <!-- IF {PAGE_ID} == xx --> JS code <!-- ENDIF -->
Replace xx with the ID of the page you want the map to display on.
You can also try pieters suggestion but that requires the page to have an alias. His code will work in footer.tpl as well (probably an even better solution).

Try this:
<script type="text/javascript"> 
  function initialize() {
    var myLatlng = new google.maps.LatLng(53.381883, -1.477755);
    var myOptions = {
      zoom: 15,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
    var marker = new google.maps.Marker({
        position: myLatlng, 
        map: map,
        title:"Sir Robert Hadfield Building"
    });   
  }
  jQuery(document).ready(function(){ initialize(); });
</script>

Don't forget to remove the onload="initialize()"]]>
пт, 03 дек 2010 02:47:10 -0000
pieter OR specific header: that page in another category and use header.CAT.tpl

OR maybe give your page an alias and add following in the standard header:

<!-- IF {PHP.al} == 'your_pagealias' -->
YOUR_CODE
<!-- ENDIF -->]]>
пт, 03 дек 2010 02:04:59 -0000
Hodges
I've got a google map on a page set to html mode. To make it work I require this in the header:

<script type="text/javascript"> 
  function initialize() {
    var myLatlng = new google.maps.LatLng(53.381883, -1.477755);
    var myOptions = {
      zoom: 15,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
    var marker = new google.maps.Marker({
        position: myLatlng, 
        map: map,
        title:"Sir Robert Hadfield Building"
    });   
  }
</script>

And this in the body tag:

<body onLoad="initialize()">

Thing is, I don't won't this code including anywhere else on the site. How would you guys solve this elegantly?

Cheers.]]>
пт, 03 дек 2010 01:24:46 -0000