How to Insert JavaScript Code into PHP Melody

Inserting any Javascript code (e.g. AdSense) into PHP Melody’s *.tpl files is very easy.

Since PHP Melody uses the Smarty template engine you do need to wrap your Javascript code between an open and close {literal} tags.

Here’s an example of how the AdSense code should be added into the <head> part of your site.

<script async src="//"></script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-0000000000000",
    enable_page_level_ads: true

Note the opening and closing {literal} tags. That’s how any kind of Javascript code should be injected into any of the *.tpl files from PHP Melody.

For the official documentation please visit:

How to Add a New Link In the Header Menu

Including a new link into your PHP Melody header menu (see image) is very easy.

All you have to do is open the template file responsible for the header and include the HTML for your new link.

In the following example we’re going to include a new link, named ‘Special Link‘ which points to Here’s how to do it.

  1. Open your /templates/[current theme folder]/header.tpl file with a plain-text editor.
  2. Search for the following code:
    {if $smarty.const._MOD_ARTICLE == 1}
  3. Add your new link right after the closing {/if} like so:
    <li><a href="" class="wide-nav-link">Special Link</a></li>

Here’s how the code should look:


That’s it. Upload the updated header.tpl file back to your PHP Melody installation and the new link will appear in the header menu.