Welcome to Genhike Sports

Stylesheet

← Back to the tag reference

Hand-written Includes in-depth notes

Stylesheet theme_css Used in page templates 21 host files / 21 calls

Render the stylesheet tag of the current template pack with its version number, so an edited stylesheet busts the cache automatically.

theme_css()

Pages Site-wide (system)

Used in
Site-wide (system)
Defined in
core/tpl_functions.php:58
Core method
(no X::y() forwarding call detected)
How do I read these repository paths?

All paths are relative to the site root. Open core/tpl_functions.php at line 58 to see the definition of theme_css(). The "core method" is what the tag actually forwards to: a template writes content_list(...) and the core runs Tpl::contentList(...).

1. Fill in parameters, get the code Edit any field and the result below updates instantly; press Copy and paste it into a template. It also works without JavaScript: press Generate and the server recomputes it.

click the title to collapse / expand

This tag takes no parameters.

Generated code

Now generating: theme_css

Real page previewOpen in new window

This is the real rendering of the page (real header, container, this tag output, real footer). It reloads when you change a parameter.

This is the server-computed default; it updates as you edit any parameter and the preview on the right is re-rendered too. It also works without JavaScript: fill the form and press Generate.

3. Examples Every example can be copied as-is; the later ones are more advanced.

click the title to collapse / expand

Minimal

One line in the head that prints every stylesheet layer at once.

<head>
    <?= theme_css() ?>
</head>

Common: paired with the head tag

Together the two lines make a complete head: one for SEO and tokens, one for the layout.

<head>
    <?= tpl_head() ?>
    <?= theme_css() ?>
</head>

Advanced: adding a stylesheet that only one page needs

Keep landing-page rules in their own file instead of polluting the site-wide theme.css.

<head>
    <?= tpl_head() ?>
    <?= theme_css() ?>
    <link rel="stylesheet" href="<?= e(theme_asset('css/landing.css')) ?>">
</head>

4. What it does / when to use it

Call it once in the head of every page template, right after tpl_head(). It prints the whole stylesheet chain in a fixed order: the shared base stylesheet, the shared theme.css design layer, the pack override theme.css, and finally the code-highlight stylesheet. An industry pack only carries what differs from the default pack, so missing one layer leaves the page with colours but no layout. Do not call it from a component partial, an AJAX fragment or a mail template: those are not complete documents and a stylesheet link in them means nothing.

5. Which pages it belongs on This is the question clients actually ask: "I am building the home page / a list page / a detail page — which tags do I use?"

click the title to collapse / expand
Page What that page is What this tag does there
Site-wide (system) Header, footer, head, styles and scripts — every page template needs them It is a system tag written once per page template, inside the page shell (head, header, footer, scripts).
You use it to: Call it once in the head of every page template, right after tpl_head()

Clicking a page name jumps to every tag for that page in the reference (the "By page" filter there). This page always shows everything about the tag, whatever that filter is set to.

6. How to use it (step by step)

  1. Write &lt;?= theme_css() ?&gt; inside the head element, immediately after &lt;?= tpl_head() ?&gt;. One call supplies the colour variables and the component layer, the other the base layout and the highlight styles.
  2. Delete hand-written stylesheet links from the template, especially any that point straight at the pack theme.css, because such a link pulls in the override layer only and loses the shared base layer and the highlight stylesheet with it.
  3. Put pack-specific styling in assets/css/custom.css. The head tag picks the file up automatically when it exists, so no template change is needed and the rules cannot leak into other pages.
  4. Keep a single-page stylesheet in its own file and load it with &lt;?= e(theme_asset('css/landing.css')) ?&gt; instead of growing the site-wide theme.css for one landing page.
  5. After editing a stylesheet, reload and compare. When nothing changes, first confirm the file was really saved, since the version parameter is derived from its modification time and updates by itself, then clear the page cache and the browser cache rather than appending a random parameter.

7. Common pitfalls

  • Hand-writing a link to the pack theme.css only: the shared base layer never loads, so the page keeps its colours and component styling but loses the layout. This is exactly how a site ends up with no layout after switching packs, and switching back makes it look fine again, which is why it gets written off as a random glitch.
  • Calling it late, or placing it just before the closing body tag: the browser only starts applying styles once the document has arrived, so users see a flash of unstyled HTML. Keep the two head calls together inside the head element.
  • Loading base.css a second time from the template: the file is downloaded twice and the cascade order breaks, because the highlight stylesheet has to stay last to override the dark code-block background defined in the base layer.
  • Treating the pack theme.css as the complete stylesheet: it is an override layer while the real layout lives in the shared layer. Editing only the pack file makes the packs drift apart over time, and a pack update can overwrite the work.
  • Trying to force a refresh with a hand-made version parameter: the URL already carries the application version plus the file modification time, so the manual value replaces the automatic one and later edits stop showing up. Clear the cache under the performance settings instead.

8. Real rendered output This section was rendered once on the server with this site real data; it is not a mock-up.

click the title to collapse / expand

It belongs to the document <head>: rendered on its own it is just a set of references that only make sense inside a <head>. Dropping it into this preview would show you raw <link> / <script> source and nothing usable. Copy it into your page template instead (right after <head>).

9. Where it already appears in your templates Grouped by components / page templates / template packs; the data comes from a script scan.

click the title to collapse / expand

Page templates 19 files / 19 calls

  • templates/_shared/404.php ×1 lines 14
  • templates/_shared/detail.php ×1 lines 91
  • templates/_shared/feedback.php ×1 lines 30
  • templates/_shared/home.php ×1 lines 34
  • templates/_shared/layout.php ×1 lines 125
  • templates/_shared/list.php ×1 lines 143
  • templates/_shared/maintenance.php ×1 lines 16
  • templates/_shared/member.php ×1 lines 55

Template packs 2 files / 2 calls

  • templates/official/detail_pkg.php ×1 lines 40
  • templates/official/home.php ×1 lines 25

Click "See this code + preview": the left shows the real code around that call site (±12 lines, call line highlighted) and the right renders a real page preview with the current parameters.

Common combinations (generated from your real templates)

  1. The page template hosting this tag is 404
  • templates/_shared/404.php

11. Previous / next In group order; this is tag 52 of 56.

click the title to collapse / expand
Send an Enquiry