Embed a style sheet on Registration page

Discussion forum for Extension Writers regarding Extension Development.
purpleperpetrator
Registered User
Posts: 4
Joined: Sun Nov 10, 2024 11:18 am

Embed a style sheet on Registration page

Post by purpleperpetrator »

My extension needs to hide portions of the registration page. How do I embed a CSS file into the header when that page is visited? Or even just CSS code? I've already created a basic extension using skeleton, and selected the PHP event listeners component, so the basic scaffolding is in place.
rxu
Extensions Development Team
Posts: 3949
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

Re: Embed a style sheet on Registration page

Post by rxu »

It's like that https://area51.phpbb.com/docs/dev/3.3.x ... -css-files

In short, it's like put similar code into the relevant extension's template file or template listener file

Code: Select all

{% INCLUDECSS '@vendor_extname/scriptname.css' %}
purpleperpetrator
Registered User
Posts: 4
Joined: Sun Nov 10, 2024 11:18 am

Re: Embed a style sheet on Registration page

Post by purpleperpetrator »

I had this working when I inserted <style> tags in styles/all/template/event/overall_header_head_append.html:

Code: Select all

<!-- IF IS_REGISTER_PAGE -->
    <style>div.captcha-panel { display: none; }</style>
<!-- ENDIF -->
But I get HTTP ERROR 500 when I try to embed a css file like so:
Also I've made sure to clear the cache after I make the changes

Create a css file in styles/all/theme/cssinjection.css with code

Code: Select all

div.captcha-panel
{
    display: none;
}
Alter overall_header_head_append.html to:

Code: Select all

<!-- IF IS_REGISTER_PAGE -->
    {% INCLUDECSS '@cssinjection/cssinjection.css' %}
<!-- ENDIF -->
User avatar
_Vinny_
Style Customisations
Style Customisations
Posts: 10266
Joined: Tue Aug 11, 2009 12:45 am
Location: Brazil
Name: Marcus Vinicius

Re: Embed a style sheet on Registration page

Post by _Vinny_ »

purpleperpetrator wrote: Sun Nov 24, 2024 7:35 pm Alter overall_header_head_append.html to:

Code: Select all

<!-- IF IS_REGISTER_PAGE -->
    {% INCLUDECSS '@cssinjection/cssinjection.css' %}
<!-- ENDIF -->
Try this:

Code: Select all

{% INCLUDECSS '@css_injection/cssinjection.css' %}
If this is the vendor and extname, it will load without errors.

Return to “Extension Writers Discussion”