Template details that may cause slowness?
Permalink
Things seem to change from day to day and documentation is spread out in multiple areas, so I would just like to ask some basic questions. These are the only things I can think of that might be causing my slowness issues which would be MY fault rather than the host or whatever.
1. I haven't been using this LANGUAGE code at all. Should the top of our template ALWAYS look like this?
2. Header Element - should this be the last thing in the header, just before the closing head tag like this?
...Or not?
3. Stylesheets - is it better to link them like this:
or like this:
I have elsewhere read and made the note:
getThemePath() is another way to link style sheets:
"If using getThemePath(), you do it like this:
getThemePath() is technically fine, but doesn't allow clients to customize styles as is possible with default C5 templates (not an issue for us since we never let clients style their themes)
getThemePath() is also faster because it is static."
Is this really true? Is getThemePath() a faster way to link the CSS?***
4. Stylesheets - do we NEED typography.css in our theme? Will not having it cause C5 to look for it, not find it and therefor slow it down?
5. Footer Element - this gets loaded last just before the closing body tag, right? Do we ALWAYS need the Footer Element? I have read some strange circumstances in the forum involving Google Analytics, for example, where people are doing different things with the Header and Footer Elements.
6. Is it for some reason really faster to split the header and footer into file includes rather than just having one simple default.php template? I can't see any reason C5 would be expecting it one way or the other.
***Btw, something weird I noticed with $this->getStyleSheet vs. $this->getThemePath methods of linking stylesheets is that background images in the CSS will either have a / at the beginning of the relative path or not, depending on which you use:
ie. url(/images/background.png)
vs. url(images/background.png)
1. I haven't been using this LANGUAGE code at all. Should the top of our template ALWAYS look like this?
2. Header Element - should this be the last thing in the header, just before the closing head tag like this?
<?php Loader::element('header_required'); ?> </head>
...Or not?
3. Stylesheets - is it better to link them like this:
<link rel="stylesheet" media="screen" type="text/css" href="<?php echo $this->getStyleSheet('main.css')?>" />
or like this:
<?php echo $this->getStyleSheet('main.css')?>
I have elsewhere read and made the note:
getThemePath() is another way to link style sheets:
"If using getThemePath(), you do it like this:
<link href="<?=$this->getThemePath()?>/style.css" rel="stylesheet" type="text/css" />
getThemePath() is technically fine, but doesn't allow clients to customize styles as is possible with default C5 templates (not an issue for us since we never let clients style their themes)
getThemePath() is also faster because it is static."
Is this really true? Is getThemePath() a faster way to link the CSS?***
4. Stylesheets - do we NEED typography.css in our theme? Will not having it cause C5 to look for it, not find it and therefor slow it down?
5. Footer Element - this gets loaded last just before the closing body tag, right? Do we ALWAYS need the Footer Element? I have read some strange circumstances in the forum involving Google Analytics, for example, where people are doing different things with the Header and Footer Elements.
6. Is it for some reason really faster to split the header and footer into file includes rather than just having one simple default.php template? I can't see any reason C5 would be expecting it one way or the other.
***Btw, something weird I noticed with $this->getStyleSheet vs. $this->getThemePath methods of linking stylesheets is that background images in the CSS will either have a / at the beginning of the relative path or not, depending on which you use:
ie. url(/images/background.png)
vs. url(images/background.png)
bump for ancient knowledge
As a relative newbie to Concrete5, I'd be interested in any "gurus" and their input on these items, too.
Anyone? Buehler?.... Buehler?....
Anyone? Buehler?.... Buehler?....
1) That is ideal, but the lang attribute isn't required by browsers or c5. Seehttp://reference.sitepoint.com/html/core-attributes/lang...
2) It depends for header element- if it is the last thing it means that tyles usually interfere less with the core, but you may have to use some !important declarations in your css file to get things the way you want.
3) getThemePath will be slightly faster, but as you noted it doesn't allow style customization. Give and take.
4) Typography.css isn't absolutely required, just strongly reccomended. It shouldn't slow things down, but it allows you to make the editor give a more accurate illustration of how things will look.
5) Footer element isn't really required, but it makes analytics a lot easier. No real required spot, put it where you want.
6) No speed issues, just makes it easier to make changes to everything at once.
7) The c5execute or die code doesn't affect c5- it just stops people from filling your error logs by viewing the theme file outside of the c5 environment.
2) It depends for header element- if it is the last thing it means that tyles usually interfere less with the core, but you may have to use some !important declarations in your css file to get things the way you want.
3) getThemePath will be slightly faster, but as you noted it doesn't allow style customization. Give and take.
4) Typography.css isn't absolutely required, just strongly reccomended. It shouldn't slow things down, but it allows you to make the editor give a more accurate illustration of how things will look.
5) Footer element isn't really required, but it makes analytics a lot easier. No real required spot, put it where you want.
6) No speed issues, just makes it easier to make changes to everything at once.
7) The c5execute or die code doesn't affect c5- it just stops people from filling your error logs by viewing the theme file outside of the c5 environment.
thank you, good sir! :)
http://www.concrete5.org/documentation/how-tos/designers/make-a-the...
and... none of these things is an issue.
In the tutorial, he links the CSS the way I always have (so this is correct… and faster according to Andrew's '5 tips to speed up Concrete5'):
Actually, the template in the tutorial doesn't even have these items:
or
So I guess these things are not necessary? I thought the Footer was necessary for some reason. Do any of these things slow down a template?