1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

custom_css.php not working

Discussion in 'Community' started by Stevebenson223, Sep 25, 2021.

  1. Stevebenson223

    Stevebenson223 Member

    Level: Community
    I have built a working membership app in my Fabrik test site which includes a custom_css.php file to make some cosmetic changes to various lists. This works fine.
    But when I re-created the app in a live site, the custom_css.php file which I copied makes no changes to the site. The rest of the app works fine.
    I'm using the standard custom_css.php file in the following location:
    components/com_fabrik/views/list/tmpl/bootstrap/custom_css.php
    Using the browser inspect tool on the live site and selecting an element I have changed, the custom_css.php doesn't appear (it does on the test site).
    As an example, I have used this custom css:
    /* hides the display button - magnifying glass - on all lists */
    #listform_$c .fabrik_actions .btn.fabrik_view {display:none}

    This works on the test site but not on the live site and, as mentioned above, it does not even appear when I select the element in the browser inspect tool. Yet, using the tool, I can type display:none in the "element:style" pane and it works!
    It's as if something is blocking the custom_css.php file. I've scoured the internet, this forum and the wiki but can't find any suggestions. I've also messaged my web hosts and I'm waiting for a response.
    I have the same set-up on both sites: Joomla 3.10.2, Fabrik 3.10, PHP 7.4 and even the same templates. I do have some components on the live site which are not on the test site, including Admin Tools, but can't find anything in the Admin Tools documentation that suggests it may be blocking the file.
    Does anybody have any suggestions? I've been trying to fix this for two weeks!
     
  2. lousyfool

    lousyfool Active Member

    Level: Community
    "Some" is a bit vague. What if you disable those components, including Admin Tools?

    Either way, with the same browser inspect tool, can you see that the custom_css.php file is getting loaded in the <head> tag?
     
    Stevebenson223 likes this.
  3. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Thanks @lousyfool , I’ll try when I’m back at my PC.
     
  4. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Hi @lousyfool, the custom_css.php file is NOT loaded into the <head> tag. In fact, compared to the test site, NONE of the stylesheets from the components/com_fabrik/views/list/tmpl/bootstrap folder are listed in the <head> tag.
     
  5. Stevebenson223

    Stevebenson223 Member

    Level: Community
    I tried disabling all the components in the live site one by one but there was no impact. However, I did notice a warning message in Admin Tools that the .htaccess file had been modified (not by me!) and I had an option to regenerate it in Admin Tools. Tried this and then reviewed the <head> tag again and lo, there are now two lines referencing the template_css.php stylesheets, but sadly not the custom_css.php.
    I feel I am inching closer (more like stumbling in the dark)...
     
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    In Admintools htaccess-maker you'll need something like
    upload_2021-9-25_18-21-3.png
     
    lousyfool and Stevebenson223 like this.
  7. Stevebenson223

    Stevebenson223 Member

    Level: Community
  8. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Hi @troester, I made the changes using the htaccess-maker and saved them, but there was no change to the website. And the custom_css.php file is still not loaded into the <head> tag.
    Cleared the browser cache and Joomla cache first as well.
    :(
     
  9. troester

    troester Well-Known Member Staff Member

    Level: Community
    You should at least see a template_css.php
    Can you see any error messages in the browser console?
    What happenes in the backend?
    What happens if you deactivate (rename) .htaccess?
    What happens if you add a custom.css to your list template (this should be loaded even if *.php are blocked). You can e.g. add some general stuff like
    td {background:yellow}

    What happens if you deactive AdminTools? You can't just disable the component/plugin you have to "Go inside the plugins/system/admintools/admintools directory on your site (on older versions of Admin Tools: plugins/system/admintools ). You will see a file named main. php . Rename it to main-disable."
     
    Last edited: Sep 26, 2021
  10. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Hi @troester
    Yes, the template_css.php file IS loaded into the <head> tag on the relevant pages.
    There is one error message on the browser console: ErrorUtils caught an error: Cannot listen to an undefined element. [Caught in: Tried to listen to element of type click]
    The backend shows the same as the front end - no changes made by the custom_css.php file. And the browser inspect tool shows the same too - template_css.php is loaded in the <head> tag but not custom_css.php
    Deactivating the .htaccess file (by renaming it) results in all my site pages showing Not Found except the Home page. There is a Fabrik list in a module on the home page and I can see the custom css has not worked.
    Adding a custom.css file works!! But I can't target specific lists (or can I?)
    Deactivating Admin Tools using the procedure above makes no difference.

    So do we conclude something is blocking the custom_css.php file but it's probably not Admin Tools?
     
  11. troester

    troester Well-Known Member Staff Member

    Level: Community
    Sounds strange, but ...
    I can't see why it should load template_css.php but not custom_css.php even with AdminTools deactivated beside something is in .htaccess (if .htaccess is there it doesn't matter if AdminTools is on or off).
    Do you have some CSS compression activated? (J!template, AdminTools...) Although I think this would also affect template_css.php...

    Can you see something pointing to custom_css.php (or enabling explicitly template_css.php) in .htaccess?

    If template_css.php is loaded you can just place your custom css in there - is this doing? (this will work until your next Fabrik update)
    You can then copy the bootstrap folder and use this copy as list template, this won't be overriden with the next update
    But this won't solve the underlying problem.
     
    Stevebenson223 likes this.
  12. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Hi @troester

    I can't find anything which may be compressing CSS. Checked my templates and Admin Tools.
    The only thing in .htaccess pointing to the specific files is the exception rules I created in Admin Tools.
    For now, I've followed your advice and put the code in the template_css.php file. This works fine, thank you.
    Maybe one day the solution will present itself...

    Thanks again for all your time and assistance.
     
  13. troester

    troester Well-Known Member Staff Member

    Level: Community
    One more thing to try: in AdminTools htaccess-maker put the custom_css.php directly into
    upload_2021-9-27_9-8-42.png
     
  14. Stevebenson223

    Stevebenson223 Member

    Level: Community
    Thanks @troester but I'd already tried that after referencing the Admin Tools documentation.

    This morning I have the solution, thanks to my vigilant web hosts....
    And I am SO embarrassed and SO sorry for wasting your valuable time...
    There was a rogue space in the file name :oops::oops::oops:
    I did look for rogue spaces at the beginning or at the end of the file name but this was custom_css .php
    All is now working perfectly.

    (@lousyfool , sorry for wasting your valuable time too)
    I am such an idiot...
     
    lousyfool likes this.
  15. troester

    troester Well-Known Member Staff Member

    Level: Community
    Sh... happens:D
     
    lousyfool and Stevebenson223 like this.

Share This Page