Include css inside entry-default.tpl

This is the right place to report general bugs, make suggestions or ask for help.
Post Reply
Panther
Posts: 52
Joined: Mon Aug 12, 2019 11:05 pm

Include css inside entry-default.tpl

Post by Panther » Sat May 30, 2020 4:22 pm

If I try to insert this script css (or any kind of css script) inside entry-default.tpl file

Code: Select all

<style>
.addtoany_list.a2a_kit_size_32 a:not(.addtoany_special_service)>span {
    padding: 5px;
    border-radius: 50px;
}
</style>
On video on webpage appears this error in all website.

Code: Select all

Fatal error: Smarty error: [in entry-default.tpl line 53]: syntax error: unrecognized tag: padding: 5px; border-radius: 50px; (Smarty_Compiler.class.php, line 441) in /web/htdocs/www.guerrenelmondo.it/home/fp-includes/smarty/Smarty.class.php on line 1100 
Instead if I call the script css as an external file:

Code: Select all

<style>
@import url(css.css);
</style>
or with 
<link href="css.css" rel="stylesheet" type="text/css">
the website works and on webpage doens't apper the error, but the script doesn't work.


Instead if I insert the script css or I call like external file css inside the static page, it works.


Any idea to works?


Below I write you the entire script:

Code: Select all

<script type="text/javascript" src="https//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4ed43d9917ed1b22"></script>
<script async src="https://static.addtoany.com/menu/page.js"></script>

<style>
.addtoany_list.a2a_kit_size_32 a:not(.addtoany_special_service)>span {
    padding: 5px;
    border-radius: 50px;
}
</style>


<br>
<div align=left><b>Condividi su:</b></div>
<br>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"><div class="a2a_kit a2a_kit_size_32 a2a_default_style addtoany_list"><a class="a2a_button_facebook"></a><a class="a2a_button_twitter"></a><a class="a2a_button_whatsapp"></a><a class="a2a_button_facebook_messenger"></a><a class="a2a_button_telegram"></a><a class="a2a_button_pinterest"></a><a class="a2a_button_linkedin"></a><a class="a2a_button_tumblr"></a><a class="a2a_button_reddit"></a><a class="a2a_button_flipboard"></a><a class="a2a_button_vk"></a><a class="a2a_button_wordpress"></a><a class="a2a_button_email"></a><a class="a2a_button_copy_link"></a><a class="a2a_button_print"></a><a class="addthis_button_informazione"></a><a class="addthis_button_compact"></a></div></div>

Panther
Posts: 52
Joined: Mon Aug 12, 2019 11:05 pm

Re: Include css inside entry-default.tpl

Post by Panther » Sun May 31, 2020 11:52 pm

Any idea why it doesn't work ?

Thanks

Tongara
Posts: 77
Joined: Wed Jan 22, 2020 11:09 am
Location: Birmingham, UK
Contact:

Re: Include css inside entry-default.tpl

Post by Tongara » Mon Jun 01, 2020 5:40 am

Yeah, Smarty is really temperamental with non-smarty compliant code, and it's annoying, but once you know how to get around it then it isn't a big deal.

Wrap your style code in {literal}{/literal} tags, like so and it should work:

Code: Select all

{literal}
<style>
.addtoany_list.a2a_kit_size_32 a:not(.addtoany_special_service)>span {
    padding: 5px;
    border-radius: 50px;
}
</style>
{/literal}
Also, as a word of advice, you only posted it 24 hours before double posting. Give people more of a chance to answer before jumping to do that. That can annoy people.

Panther
Posts: 52
Joined: Mon Aug 12, 2019 11:05 pm

Re: Include css inside entry-default.tpl

Post by Panther » Mon Jun 01, 2020 11:28 am

Sorry......thanks for reply.
It works perfecty.
I didn't know {literal} {/literal}

Tongara
Posts: 77
Joined: Wed Jan 22, 2020 11:09 am
Location: Birmingham, UK
Contact:

Re: Include css inside entry-default.tpl

Post by Tongara » Mon Jun 01, 2020 5:25 pm

Panther wrote: Mon Jun 01, 2020 11:28 am Sorry......thanks for reply.
It works perfecty.
I didn't know {literal} {/literal}
Yeah, I had to go searching for it myself to find a solution to constant smarty errors at any kind of code that Smarty doesn't recognise. I think I looked through the actual Smarty documentation to find that out.

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests