0

I created an animation with html and css which i want to include in a joomla site. Now i dont want to load all the css file for this animation on every page of the site. Is it possible to load the css for this animation just on one page in joomla?

Thx for your help!

3
  • you should be able to just upload the .css file and refer to it from your html pages(<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />). Not sure if Joomla needs anything specific added for that though. Commented Jan 17, 2014 at 15:13
  • @Amber - Joomla doesn't use a html file for each page. It's a CMS and applications for each page get pushed to 1 main index.php file Commented Jan 17, 2014 at 15:20
  • @Lodder The user implies that they will need to post the html in order to display the 'css animation' though, so adding that to the html could still easily solve his/her problem. Commented Jan 17, 2014 at 15:23

2 Answers 2

1

Assuming you have inserted your HTML in an article, what you can do is install Sourcerer which allows you to add custom code to your articles. Once installed you can use the following to import a CSS file:

{source}
<?php
    JHtml::_('stylesheet', JUri::root() . 'path/to/your/file.css');
?>
{/source}

or if you don't want to import a file, you can just insert the CSS like so:

{source}
<style>
    #element {
        /* some code */
    }
</style>
{/source}

If Sourcerer seem like quite a heavy plugin to use, you can also download DirectPHP else you could developer a small module

Sign up to request clarification or add additional context in comments.

Comments

0

It's a bit unclear what you mean by "one page" since a page is dynamically generated. Do you mean whenever a specific article (or weblink, contact, user profile, or an item from a specific extension) is displayed? Or do you mean you only want it to display when when specific instance of that item i.e. normally a menu link with an itemid and all the associated information about templates and modules and other options is set in a specific way?
Also do you just want to do this one time only or do you want a general solution that will let you potentially put this on a number of separate pages in the future or even to do the same thing with other css and animation? You need to clarify what you want in order to get the right advice.

For example, if you really just want it for this site and one specific page, just put an if in your index.php of the template and check the url for the Itemid or the id.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.