Search code examples
phphtmlfacebookfacebook-likebox

Like Box not showing in some urls


I have a simple yet hard problem here that is driving me nuts ...

Apparantly with no code change what so ever the Facebook and Google+ like boxes show as I want in one section of my site: http://www.nfrases.com/coragem

Yet on the other they just disappear, like on this page: http://www.nfrases.com/coragem/1519

The only difference is that a id_phrase is also suplied instead of only supplying the tag_name in the address that is picked by the php with $_GET and then the mod_rewrite intervenes. The actual address is: http://www.nfrases.com/tag.php?tag_nome=coragem&id_frase=1519

I'm going crazy over here! Someone ?


Solution

  • You are using a relative path for your javascript:

    <script src="js/scripts.js"></script>
    

    So, on http://www.nfrases.com/coragem, that would point to:

    http://www.nfrases.com/js/scripts.js

    But, on http://www.nfrases.com/coragem/1519, that would point to:

    http://www.nfrases.com/coragem/js/scripts.js

    The 2nd URL doesn't exist, obviously. You need to change your script path to:

    <script src="/js/scripts.js"></script>
    

    Same rule applies for some of your images too. Example:

    <li><a href="#"><img src="images/rss.png" alt="rss"> Acerca</a></li>
    <li><a href="#"><img src="images/rss.png" alt="rss"> Sugestões</a></li>
    <li><a href="#"><img src="images/rss.png" alt="rss"> Contactos</a></li>
    

    Should be:

    <li><a href="#"><img src="/images/rss.png" alt="rss"> Acerca</a></li>
    <li><a href="#"><img src="/images/rss.png" alt="rss"> Sugestões</a></li>
    <li><a href="#"><img src="/images/rss.png" alt="rss"> Contactos</a></li>