Styles and scripts directly in templates?

Go down

Solved Styles and scripts directly in templates?

Post by Kami-sama on December 20th 2017, 8:01 pm

Simple question, is it okey to have style and script directly in template itself?

I was thinking, that if I put a script inside the template instead of having it applied to ALL PAGES this would boost page loading. Same with styles. I wonder if there are any drawbacks of doing so? I guess general style and script settings should be used when changes are wanted for elements in every forum page....


Last edited by Kami-sama on December 20th 2017, 9:17 pm; edited 1 time in total
avatar
Kami-sama
Forumember

Female Posts : 405
Reputation : 12
Language : EN, RU, DE, LT
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by APE on December 20th 2017, 8:29 pm

Hello there is no real problem with it as long as you don't over do it.

If you add a lot it may slow things down a lot but little codes are fine.

Only real problem is if we have updates them codes may not work and it will not show up on our tools if we need to help you fix the problems, or some updates may not work due to your changes.



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by Kami-sama on December 20th 2017, 8:34 pm

But if a template layout is adjusted anyways it should not be a problem?
In your opinion, what is better, considering that template layout is adjusted either way. Is it better to have adjusted layout style and script together or separately?
avatar
Kami-sama
Forumember

Female Posts : 405
Reputation : 12
Language : EN, RU, DE, LT
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by APE on December 20th 2017, 8:36 pm

it's always better to code them together so its faster loading and it makes it easier to changed codes when needed.



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by Kami-sama on December 20th 2017, 8:41 pm

I do agree. Was only wondering if there would be anything bad doing so. Cool.

While adding style is straightforward. The script I noticed is slightly different.
Why is this needed in the template:
Code:
<script type="text/javascript">
//<![CDATA[
avatar
Kami-sama
Forumember

Female Posts : 405
Reputation : 12
Language : EN, RU, DE, LT
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by Justice™ on December 20th 2017, 8:50 pm

The CDATA thing has to do with XML, I don't know exactly what it means but a google search would probaly help you. It's safe to remove it. Adding JS and CSS in the templates is not necessarily a bad thing. If you have a lot of codes, it's a good idea to add them that way:css that has to do with topics to the topic templates and so on. But if you have few lines of code, you should just add them in a single file.
avatar
Justice™
Forumember

Posts : 536
Reputation : 124
Language : Romanian and English

http://board.realmsn.com

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by Kami-sama on December 20th 2017, 9:11 pm

@Justice™ wrote:The CDATA thing has to do with XML, I don't know exactly what it means but a google search would probaly help you. It's safe to remove it. Adding JS and CSS in the templates is not necessarily a bad thing. If you have a lot of codes, it's a good idea to add them that way:css that has to do with topics to the topic templates and so on. But if you have few lines of code, you should just add them in a single file.

Yeah, I have lots ;D especially style.
That's why I decided to sort it next to templates they are applied to.

CDATA sections in XML. In an XML document or external parsed entity, a CDATA section is a section of element content that is marked for the parser to interpret purely as textual data, not as markup.
avatar
Kami-sama
Forumember

Female Posts : 405
Reputation : 12
Language : EN, RU, DE, LT
Location : Lithuania

http://hogas.huhohi.com/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by APE on December 20th 2017, 9:34 pm

is this now solved for you as its marked solved by Icon ?



avatar
APE
Administrator
Administrator

Male Posts : 12458
Reputation : 1304
Language : fluent in dork / mumbojumbo & English haha

http://chatworld.forumotion.co.uk/

Back to top Go down

Solved Re: Styles and scripts directly in templates?

Post by Draxion on December 27th 2017, 7:36 am

Problem solved & topic archived.
Please read our forum rules: ESF General Rules


NEVER provide your founder's account or email
Please provide forum's URL when dealing with design and appearance issues
Don't forget to mark the topic as when the issue is resolved. This helps the staff greatly.
PM Support is prohibited!
TOS | General Rules | FAQ | Tricks & Tips | Latest Updates | Introduce Yourself

avatar
Draxion
Support Moderator
Support Moderator

Male Posts : 2161
Reputation : 274
Language : English
Location : USA

http://www.draxionsgameden.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum