Hello everyone, I have developed a plugin to modify the css of the elgg home screen, but it is not working I need help.
follow codes for analysis:
start.php
<?php function modifica_init()
{
$priority = 1000;
elgg_register_css('estilo','views\default\estilo.css');
elgg_extend_view('elgg.css','views\default\estilo.css', $priority);
} ?>
I have the well-configured view folder and the css file inside it to replace.
Some things are in Portuguese because I'm Brazilian.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- Nikolai Shcherbin@rivervanrain
Nikolai Shcherbin - 0 likes
- Initializer
- View extension
- Rohit Gupta@Rohit_1990_3676
Rohit Gupta - 0 likes
- iionly@iionly
iionly - 0 likes
You must log in to post replies.1 - Move on github and share your code.
2 - Learn docs.
3 - Use the existing skeleton plugin.
4 - Coding:
So, your start.php should be:
Problem 1: You css is not working because other css might be getting a priority. You can try using !important in your css
Example:
Problem 2: Your css is not loaded correctly. You can use the following code in your start.php file
Alternatively, you can also try the solution given by RvR to load your css.
Assuming your css file is at mod/modifica/views/default/modifica/estilo.css you would load ADDITIONAL css code simply by this line in the init function in start.php of your plugin:
If you place your "modifica" plugin at the bottom of the list of plugins in the admin section plugin page estilo.css will be added last to elgg.css.
Depending on what changes you want to make it might not necessary to do it this way though. If you only want to modify the css code of an existing css file, you wouldn't "extend" a css file (e.g. elgg.css) but you would just place your modified file at the same subpath within your plugin as it has been in the other plugin (or of Elgg core). For example the Aalborg theme overrides the Elgg core file vendor/elgg/elgg/views/default/elements/layout.css by a modified file by placing the changed file at mod/aalborg_theme/views/default/elements/layout.css. The same can be done with a plugin if you want to override the css file of another plugin if you just place your plugin below the other to overide the original file with your modified file. Then you don't need to use elgg_extend_view() in start.php at all as Elgg handles the overriding of the files automatically.
P.S. the closing ?> at the end of php files should not be added. Elgg handles this on its own already.